sinjin
11-20-2004, 11:37 AM
I'm using GeekTool to display iTunes info on my desktop based on comments to a posted hint:
http://www.macosxhints.com/article.php?story=2004070301135736
My question is, is it more efficient (less processor intensive) to use a shell script wrapper to check if iTunes in running before running the Applescript to get iTunes info OR to go purely with Applescript to do the same thing. For those unfamiliar with GeekTool, essentially what is going to happen is it is will run these scripts at a repeating interval (probably 10 s). Examples follow:
Shell version (note, pasted as original author wrote it, with my comments:
#!/bin/sh
app=$1 #I guess I set this to iTunes
scpt=$2 #I guess I set this to the path of my Applescript
if [[ -n "`ps -x | grep /Applications/${app}.app | grep -v grep`" ]]; then
osascript $scpt | iconv -f utf-8 -t ucs-2-internal
fi
Or Applescript:
tell application "System Events"
if process "iTunes" exists then
--the rest of the script goes here
end if
end tell
Thanks! Mark
http://www.macosxhints.com/article.php?story=2004070301135736
My question is, is it more efficient (less processor intensive) to use a shell script wrapper to check if iTunes in running before running the Applescript to get iTunes info OR to go purely with Applescript to do the same thing. For those unfamiliar with GeekTool, essentially what is going to happen is it is will run these scripts at a repeating interval (probably 10 s). Examples follow:
Shell version (note, pasted as original author wrote it, with my comments:
#!/bin/sh
app=$1 #I guess I set this to iTunes
scpt=$2 #I guess I set this to the path of my Applescript
if [[ -n "`ps -x | grep /Applications/${app}.app | grep -v grep`" ]]; then
osascript $scpt | iconv -f utf-8 -t ucs-2-internal
fi
Or Applescript:
tell application "System Events"
if process "iTunes" exists then
--the rest of the script goes here
end if
end tell
Thanks! Mark