Cool, thanks, the first method works well for Tiger. But the Leopard method only works in Leopard, as in the first example won’t work in Leopard?
If this is the case, then how would I detect OS’s and switch accordingly, as in what’s the syntax for detecting OS’s in order to use the appropriate command?
the version using “System Events” works in Panther, Tiger and Leopard
Sweet, thanks so much and God Bless you!
Ben.
Hey, I started another thread about this, but no one replied, so I’ll just ask you if that’s cool.
I added this code:
–on closeSoftware()
– tell application “System Events” to set myApp to exists process “Software”
– if myApp then
– quit application “Software”
– else
– continue Deleter()
– end if
–end closeSoftware
So this works perfectly cross -OS platform as well as you stated, however, when I delete the software, and try opening my script to edit it, it doesn’t launch the script editor, it gives me a dialog box stating that the software is missing and is looking for it. It’s almost as if the software that I uninstalled successfully becomes a dependancy for the script to launch in the script editor…why is that? How can I get past this?
Thanks,
Ben.
If you open a script with Script Editor, the script will be recompiled.
That means, Script Editor target every used application to resolve its terminology.
To avoid this, either use a shell script or put the name of the application in a variable or property as literal string
property theApplication : "Software"
on closeSoftware()
tell application "System Events" to set myApp to exists process theApplication
if myApp then
quit application theApplication
else
Deleter()
end if
end closeSoftware
the continue command is only needed in a quit handler or
for polymorphism in script objects
That seemed to work…thanks a lot dude!