Bundling AppleScripts with shell scripts
Bundling AppleScripts with shell scripts
- Subject: Bundling AppleScripts with shell scripts
- From: Doug McNutt <email@hidden>
- Date: Mon, 1 Sep 2003 10:56:44 -0600
Andrew Trevorrow has contributed a couple of executables, written in C, which convert line ends in place without messing with type and creator. <
ftp://ftp.trevorrow.com/m2u-u2m.sit>
I would like to provide a drag and drop interface using AppleScript. The code below works fine on my system but how can I send it off to users who are not Terminal savvy? Is there a standard procedure I can use for getting the two shell scripts in a politically correct place with matching specifications in the AppleScript? How about setting the permission and execute bits for the binaries? I shudder at the prospect of writing instructions. Is it easier to write an install script? Would administrator privilege be required to install the binaries in the "correct" location for access by any user?
*** begin script ***
property basedir : "$HOME/Projects/LineEnds/"
property executable : "u2m" -- change to m2u for other way
-- 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 thePath to quoted form of POSIX path of bbb
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 thePath to quoted form of POSIX path of theAlias
my doStuff(thePath)
end repeat
beep
end tell
end open
on doStuff(aPath)
do shell script basedir & executable & space & aPath
end doStuff
*** end script ***
--
Applescript syntax is like English spelling:
Roughly, but not thoroughly, thought through.
_______________________________________________
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.