Re: Writing an Uninstaller
Re: Writing an Uninstaller
- Subject: Re: Writing an Uninstaller
- From: Abhi Beckert <email@hidden>
- Date: Fri, 29 Oct 2010 15:12:03 +1000
On 2010-10-29, at 12:14 PM, eveningnick eveningnick wrote:
> Thank you guys for answer, but the problem still remains for me
>
>> HI ,
>> launch an applescript / shell script when uninstall button is clicked . This should first quit the App and wait for it to terminate and then delete the bundle and plist
>> Rajendran P
>
> I'm sorry for asking such a primitive question but could you point me
> how can that be done? How can i schedule a script to be executed after
> my process is terminated? AppleScript call like
>
> [[[[NSAppleScript alloc] initWithSource:@"tell finder to delete
> something"] executeAndReturnError:nil];
> [NSApp terminate];
I think he means create an applescript in Script Editor or Automator, and select "Application" in script editor's save-as dialogue. This way you just need to launch the applescript application, and then do [NSApp terminate].
I haven't done any AppleScript programming for about 10 years... but this seemed to work fine with some testing, regardless of whether or not my app was running:
> tell application "Finder"
> set appAlias to item "Sequel Pro.app" of (path to applications folder)
> move appAlias to trash
> end tell
Note that because the file is being moved to the trash by Finder, the dock icon is properly updated, the standard "moved to trash" sound is played, the user can use finder's "edit -> undo" feature to move it back to the applications folder, and if admin privileges are required — Finder will handle that for you.
- Abhi_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden