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

Click here to return to the 'Uninstall an AppleScript application from within Itself' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Uninstall an AppleScript application from within Itself
Authored by: trosberg on Dec 15, '09 11:28:25AM
From user point of view, Finder has some bugs, but every version has been better. In Mac OS X 10.4 Finder there is the horrible lack of refresh, when some other app added something to a folder. The Finder can even be AppleScripted to refresh, but it didn't work. From scripter's point of view, the Finder has a learning curve, but it is more understandable and reliable than e.g. System Events scripting. Thanks to tedw for nice Finder scripting. The same:

on applicide()
	set myAppFile to path to me as string
	tell application "System Events"  
		delete disk item myAppFile
	end tell
end applicide
It is valid System Events scripting. It doesn't work in spite of file scripting possibilities with System Events. When saved as an app and then run from AppleScript Editor in 10.6 it shows buggy behavior. Besides, term "me" has changed meaning a little between Mac OS X 10.4 and 10.6. In the latter it means the script app, in the older the Script Editor, when run from the Script Editor. Have your backup ready if trying! The example shows one of AppleScript's flaws, the varying terminology in same task between apps.

[ Reply to This | # ]