Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'why applescript?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
why applescript?
Authored by: foon on Jan 15, '03 12:05:06PM

Can anyone tell me what's gained by using applescript to call the shell command, rather than just using this as a shell script? For example, I've written myself a little program that takes a screenshot every minute, converts it to jpg (using imagemagick), and saves it in my web directory:

#!/bin/sh
if [[ $# -ne 0 ]]
then
for id in `ps | grep screenie | cut -f 1 -d " "`
do
kill $id
done
cp /Library/WebServer/Documents/screenoff.jpg /Library/WebServer/Documents/screenie.jpg
exit 0
else
while (true)
do
screencapture /tmp/s.pdf
convert -page 1280x1024 -size 640x512 /tmp/s.pdf -resize 640x512 /tmp/s.jpg
cp /tmp/s.jpg /Library/WebServer/Documents/screenie.jpg
sleep 60
done
fi

Saved and appropriately chmoded, this will start taking screen shots if given no argument, and if given an argument, will kill all instances of itself (effectively shut down) and put up an "away" image.



[ Reply to This | # ]
why applescript?
Authored by: ClarkGoble on Jan 15, '03 04:01:35PM

You can double clip an icon. I prefer the shell myself, but a lot of people don't.



[ Reply to This | # ]
why applescript?
Authored by: FACEMILK on Jan 15, '03 09:04:09PM

better yet:

write the shell script to just take the picture,
let cron handle the timing and repetition



[ Reply to This | # ]