• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)


  • Subject: Re: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
  • From: Axel Luttgens <email@hidden>
  • Date: Sat, 14 Apr 2007 16:57:15 +0200

On 11/04/07 16:53, Jason Danielson wrote:

i have 2 issues and the first is quite involved but i'll try my best to describe in detail.

1)

essentially, i'm trying to write an uninstaller in applescript that removes some application data and the application itself. the problem is when i try to delete the applescript uninstall script itself. it is compiled as an application bundle and placed inside the main application bundle. when the script deletes the application bundle (and itself indirectly) i can't avoid getting the following error: "Could not save changes to this script because of a disk error. -43."

the operation that deletes the bundle is
do shell script "rm -rf /Applications/Prog.app" with administrator privileges


since an applescript deleting itself caused this ugly error,


Well, it isn't that ugly... ;-)
(I'm not speaking here about the delicious idea of a suicidal program)
The script, while running, is in memory; when it finishes, it tries to write its new state back to its file, if needed.
This means that your script has something to write back: properties or global variables whose values have changed.
Perhaps would it be possible to avoid that error message by just avoiding those changing properties and/or globals.
But I agree, I am just guessing here, as a lot of info is missing (which OS version, which programming environment, how does the script get invoked, how is it written...?).


i decided to try a different approach. [...]


I'm a bit lost with your description here...
Again, some more info would be welcome! Could you for example provide us with a short sample code just sufficient to reproduce the symptoms?


Now, your approach seems to be rather complicated, and liable to anyway encounter the same problems as above, as you are just running another script.
Perhaps could you try something like this from your main script:


do shell script "{ sleep 10; rm -fR /path/to/the/app; } >/dev/null 2>&1 &" with administrator privileges

The idea being to launch the shell command in the background, and to provide some delay for your applescript to quit before deleting the whole stuff.


so: how does an applescript delete itself without this error OR how does one applescript run another applescript from a temp directory consistently?


2)

the other problem i'm having is more of a UI complaint. because i'm using applescripts compiled to application bundles for installation and uninstallation, the UNIX binary that they are compiled to is defaulted to "applet." when a random user runs the install script and they are prompted to elevate to perform certain administrator tasks, the prompt says:
"applet requires that you enter your administrator password" even though the application bundle is called something else. i tried renaming the binary from applet to something else and changing it in the Info.plist file as well. when i do this, the script (which was never compiled with the startup screen enabled) starts showing the startup screen which annoyingly asks the user to confirm they wish to run the script. after that it works fine but we don't want that confirmation startup screen. is there a way to either customize the default elevation prompt (from calling do shell script "..." with administrator privileges) or compile the applescript with a custom unix binary filename (CFBundleExecutable)?


Let's say you want to have "jason" instead of "applet" appear into the prompt.
After some trials and errors, this seems to work here:
1. Save your script as application bundle "jason" (do not check the "executable only" box) and close its window in SE.
2. In the bundle's Info.plist, replace every occurence of "applet" with "jason".
3. For every file having "applet" in its name, replace that string by "jason".
4. Re-open the bundle in SE.
5. Re-save it from SE.
6. Double-click the bundle; the prompt should now be "jason requires that...".
You may now replace the bundle's main.scpt by any other script, for example by its "executable only" version.


HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
      • From: "Jason Danielson" <email@hidden>
References: 
 >applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable) (From: "Jason Danielson" <email@hidden>)

  • Prev by Date: Re: Creating new file etc (re-wrote due to large bug)
  • Next by Date: Re: Mail scripting
  • Previous by thread: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
  • Next by thread: Re: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
  • Index(es):
    • Date
    • Thread