Running shell scripts from a droplet
Running shell scripts from a droplet
- Subject: Running shell scripts from a droplet
- From: Doug McNutt <email@hidden>
- Date: Tue, 24 Dec 2002 13:40:08 -0700
There have been requests for scripting the Terminal and for procedures for creating files with an effective creator code for Terminal ( add a .command suffix).
I have been using this AppleScript for executing a shell script either dropped or selected in finder. It appears not to use Terminal at all but one can never really be sure. The environment variable $SHLVL = 2 on entry to the script which means that something else is running.
****
-- This section runs while in the script editor.
-- Starting point is selection in the finder.
tell application "Finder"
set argList to selection
repeat with theTarget in argList
set bbb to theTarget as alias
set aaa to POSIX path of bbb
set thePath to aaa as string
my doStuff(thePath)
end repeat
end tell
-- This happens when icons are dropped onto the script in Applet form.
-- Note that finder resolves any aliases even though it delivers alis's in arglist.
on open (argList)
tell application "Finder"
repeat with theAlias in argList
set aaa to POSIX path of theAlias
set thePath to aaa as string
my doStuff(thePath)
end repeat
end tell
end open
on doStuff(aPath)
do shell script aPath
end doStuff
--
-> Half of US citizens pay 3% of the income tax, yet can vote to increase taxes to be paid by the other half. <-
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.