applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
- Subject: applescript uninstaller delete itself & customizing applescript application bundle binary filename (CFBundleExecutable)
- From: "Jason Danielson" <email@hidden>
- Date: Wed, 11 Apr 2007 06:53:59 -0800
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, i decided to try
a different approach. i tried to have the uninstall script copy itself
to a temp location, run it from there and return. this would allow the
script in the temp location to delete the main application bundle with
no errors. however, this revealed a different problem. running a script
from any temp location works exactly half the time.
i clean, copy and run the temp script by doing the following operations:
do shell script "rm -rf '" & tempPath & "'"
do shell script "cp -R '" & myPath & "' '" & tempPath & "'"
ignoring application responses
tell application "Finder" to open tempPathEx
end ignoring
the
ignoring line allows the current script to return after starting the
temp path script instead of waiting for it to exit. when i try copying
self to a non temp location (such as the current user's home directory)
it works every time. but as soon as i try any location under
/private/tmp or /private/var/tmp then it works exactly half the time.
the uninstall script essentially launches the temp script yet it does
not run at all. i tried putting a display dialog as the first line and
it would only show it half the time.
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)?
thanks for reading this mammoth.
---
Jason Danielson
Itiva Development Corp
_______________________________________________
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