Skip navigation

Applescript to Duplicate Files without Finder?

537 Views 3 Replies Latest reply: Jan 26, 2013 7:36 AM by red_menace RSS
MacOSXNoob Calculating status...
Currently Being Moderated
Jan 25, 2013 3:01 PM


I have an app I made in Xcode that takes a PNG image that the user chooses and makes it the Finder, Empty Trash, or Full Trash icon. It works well, but there is one thing that bugs me. Because it is making a system change, it requires a password. But the window says "Finder wants to make changes. Type your password to allow this." but I want it to use my app's name and icon. How can I change the script so that the app duplicates, not Finder?

Also, here is my current script:

on EmptyTrashButtonPushed_(sender)

        set EmptyTrashIcon to (choose file with prompt "Choose a PNG icon to use for your Empty Trash icon:" of type {"PNG"} without invisibles)

        tell application "Finder"

            set theDupe to (duplicate EmptyTrashIcon) as alias

            set the name of theDupe to "trashempty.png"

            move theDupe to "Macintosh" with replacing

        end tell

        do shell script "killall Dock"

    end EmptyTrashButtonPushed_


I want it to duplicate the original file so that the user's file stays untouched.

Thank you very much

MacBook Pro, OS X Mountain Lion (10.8.2)


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.