Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > adding executable to toolbar???

adding executable to toolbar???
Thread Tools
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
Aug 21, 2003, 09:21 PM
 
This may be a trivial question, but I'm trying to figure out how to add a button on the toolbar for a small perl script I wrote. The script, when run from the current directory, creates thumbnails of all the images using Image::Magick. I'm able to add the script to the toolbar, but when I click it, the text is simply opened instead of being executed. How did I get the execution to take place? Ideally, I'd like to be able to open a terminal window from the current location and then run the perl script command by clicking on the toolbar button.

Thanks.
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Aug 21, 2003, 10:31 PM
 
Change the name of the script by giving it the extension ".command". These file types are automatically opened as Terminal documents and executed there (if possible).

If you don't want it to open in a Terminal, there are utilities available to transform a script into a little application.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 21, 2003, 10:34 PM
 
Ne'ermind. Brass beat me to it.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
milf  (op)
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
Aug 23, 2003, 08:21 AM
 
Okay, thanks for the feedback. I added the .command extension and after toying around a bit with permissions, the script attempts to run after clinking the icon on the toolbar.

My only problem now is that it's running the script from my home directory instead of on the current directory. The perl script grabs the current directory path. How do I get the script to execute from the current directory instead of from my home directory like it's currently doing?

Also, any links to apps that convert script to applications?
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
Sal
Dedicated MacNNer
Join Date: Sep 2000
Location: Cupertino, CA USA
Status: Offline
Reply With Quote
Aug 23, 2003, 11:23 AM
 
There's an easy way to run PERL or Shell scripts... use the Script Menu utility located in Application > AppleScript. Place your scripts in Home > Library > Scripts and they'll appear at the bottom of the System-wide scripts menu.
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Aug 23, 2003, 11:05 PM
 
You might need to wrap it in AppleScript, or call osascript in your script with something like

Code:
tell application "Finder" if front window exists then set thisPath to POSIX path of ((target of front Finder window) as alias) else set thisPath to POSIX path of (desktop as alias) end if end tell
[Wevah setPostCount:[Wevah postCount] + 1];
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:22 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2