Apr 30, '02 09:09:50AM • Contributed by: porkchop_d_clown
The following script makes all that work unnecessary. It uses the newest extensions to AppleScript to detect XDarwin and start it if it isn't running, and uses the new POSIX command to convert the file name to a format that the gimp will understand. The upshot is that the first time you drop something on this script, it will automatically start X and the Gimp for you. This can be slow that first time (starting X can take a while) but it saves you a couple of steps.
Read the rest of the article for the script...
Here's the AppleScript source:
on check_for_x()Note: I believe that "do shell script" requires that you have built this script with Project Builder, not the Script Editor.
tell application "Finder"
if ((name of processes as list) does not contain "XDarwin") then
launch application "XDarwin"
delay 30
end if
end tell
end check_for_x
on open these_items
check_for_x()
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
--display dialog "export DISPLAY=localhost:0.0;/sw/bin/gimp-remote -n " ¬
& "\"" & POSIX path of this_item & "\""
do shell script "export PATH=\"$PATH\":/sw/bin;export ¬
DISPLAY=localhost:0.0;gimp-remote -n " & "\"" ¬
& POSIX path of this_item & "\""
end repeat
end open
[Editor's note: 'porkchop' provided both a precompiled binary version of the script and the Project Builder source files. You can download either one (binary, source files) from my iDisk.]
