Running an entire Applescript with Administrator Privileges?

Is that possible from an AppleScript?

My goal is to perform several file operations that require admin privs. When I perform them in a “normal” script, then each operation pops up a login dialog. I want to have only a single dialog pop up for all operations.

I’ve tried to use

do shell script "osascript my.scpt" with administrator privileges

but that doesn’t help - I get even one more admin dialog then.

Is there a way to authorize multiple privileged file operations (duplicate, delete) in one go, using AppleScript?

I realize I could use bash shell commands for these operations instead, but that’ll make things more complicated for my purpose. I like to keep it all in AppleScript code if possible.


short answer: It’s not possible.

The authorization dialog windows belong to the Finder not to AppleScript.

The only way to do it is the shell, actually it makes things easier and more efficient.
Like directly in the period to run multiple commands with a single authorization is 5 minutes.

Okay, bummer.

Does someone know a “safe” shell command to move a file to the Trash? With safe I mean the way the Finder does it, renaming the file if the name is already present in the Trash. And, of course, moving it to the trash of the volume the file resides on in case it’s not on the root volume.

That’s getting fairly complicated - that’s why I was looking to solve this in plain AppleScript.