Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Ask one/first time for password in Xcode/applescript app?

Hello,


I've an app, that's replacing/deleting/copying files a lot.

The annoying thing is that each time finder (or gives my app finder the command to) replaces/deletes/copy files,

finder(/my app) ask for the user password... And 'each time' is a lot in my app...


I understand I can't disable this security measure, but is there a way it only ask when my apps starts?

I know it's possible, because I saw it somewhere in a app...


Thanks in advance,


Isaiah


P.S. Isn't it weird, the 'asks for password'-dialog says 'Finder wants to replace/delete/copy files', but when you do that trough Finder, the dialog doesn't show up 😉...

Applescript-OTHER, Mac OS X (10.7.2)

Posted on Jun 22, 2012 9:35 AM

Reply
2 replies

Jun 22, 2012 10:56 AM in response to Drake69

It looks like you are placing your application support files in a location that the user doesn't have access for - normally, you should be using the acount that is running the application. See the File System Programming Guide.


There are methods (both Cocoa and Standard Additions) to get paths to the various default locations that you should look at using. For example, my startup disk is not named "Macintosh HD", so your application fails at just about everything on my machine.


BTW, using NSOpenPanel will avoid that annoying choose file bug.

Aug 19, 2012 8:06 AM in response to Drake69

I already got it, I just replace the Finder commands with Terminal commands.


Example:


"

do shell script "the_First_shell_script" with administrator privileges

do shell script "the_Second_shell_script" with administrator privileges

do shell script "the_Thirth_shell_script" with administrator privileges

"

It'll only ask one time for a password + The 'asks for password'-dialog says 'MY_APP wants to replace/delete/copy files' with MY_APP icon, instead of Finder ask...

Ask one/first time for password in Xcode/applescript app?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.