Re: starting apps by clicking icons
Re: starting apps by clicking icons
- Subject: Re: starting apps by clicking icons
- From: Marcelo Camperi <email@hidden>
- Date: Thu, 6 Mar 2003 09:54:06 -0800
Hello,
I have received a number of emails from people who read my posting
asking for help on clickable applications but missed others I referred
to there. Hoping that the list will not mind the bandwidth, I am
posting here a compilation. Thanks to Sandor Sklar and Francois Rigaut,
who provided the know-how.
To create a clickable icon for xterm (for example), create a script in
AppleScript Editor that looks like this:
tell application "X11"
activate
end tell
do shell script "export DISPLAY=:0 ; /usr/X11R6/bin/xterm -geometry
80x32+18+32 -fa Monaco -fs 10 -bc -hold -ls -rightbar -rw -sb -sl 1000
/dev/console 2>&1 &"
Now save as "application", and click away. X11 will be started if it
was not running, and then xterm will be started.
This script starts your xterm in root directory "/", as it will happen
with everything you start this way. I added the following simple-minded
workaround:
do shell script "export DISPLAY=:0 ; cd /Users/myusername ;
/usr/X11R6/bin/xterm ...."
This does the trick for me.
You can now copy-n-paste an icon from anywhere else on the "get info"
windows. If you have a collection of icons in different formats (like
for example all gnome icons from RedHat linux :-), you can use a
utility called Pic2icon (freeware - OSX downloads) to generate OSX
icons for all of them that are meant as previews of pictures in the
finder. You can then "get info" one of them to copy the OSX icon.
You can also write a regular shell script to start an application, and
then use DropScript (freeware - OSX downloads) to generate an
application that will run the shell script. The way to activate x11 by
these means is to use the line:
osascript -e 'tell application "X11" to activate'
at the start of your shell script. For me, the AppleScript method
worked the best.
Am AppleScript to generate icons in which you can drop files to be open
looks like (for example, to open .ps in gv):
tell application "X11"
activate
end tell
on open DroppedItems
repeat with EachItem in DroppedItems
set thefile to POSIX path of EachItem
do shell script "/sw/bin/gv -d localhost:0.0 " & quoted form of
thefile & " 2>&1 &"
end repeat
end open
I am having a lot of fun with this! Enjoy!!
Marcelo
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.