I am very new to applescript and am having difficulty with something that should be very simple.
First I want to check if iTunes is running, I have found this.
tell application “System Events” to (name of processes) contains “iTunes”
Unfortunatly it only gives a true/false in the debug window, how can I pass this into a variable that I can actually use? (do if *** then on)
Secondly, once I have confirmed iTunes is not running, how can I change the file that an alias points to, specifically I have replaced the iTunes library and xml file with aliases, and want to change the files the alias points to?
Thank you and
Kind regards,
dave
Is this what you mean?
tell application "System Events"
set iTunesIsRunning to (name of processes) contains "iTunes"
if ( iTunesIsRunning ) then
-- do something here
else
-- do something else
end if
end tell
The “alias file” class in the Finder has an “original item” property, which I believe you can simply set:
tell application "Finder"
set myAliasFile to alias file "path:to:your:alias_file"
set original item of myAliasFile to file "path:to:new:file"
end tell
Thankyou, that was exactly what I needed, I was struggling with the change in style between “programing” languages and applescript.
Hooray, my first ever applescript works, now for one with a user interface
Cheers, dave