Hello everyone, First of all I would like to apologize if there is a topic here about this I did not find, and besides I am a noob in AppleScript so I would like the help from you, I would like to know how do I copy one file from one specific location to another for example:
I have some photos on the desktop and wanted to select them and copy them to another location using AppleScript, please I know this is a silly example bear in mind that I am learning so please do not be so hard on me, thank you in advance to all .
I try this:
on copyFile_(sender)
set myFile to choose file with prompt "Choose a Kext to Install:"
set myFolder to choose folder with prompt "Choose Folder:"
tell application "Finder"
duplicate myFile to myFolder with replacing
end tell
end copyFile_
but I get this error:
Error Domain=PlugInKit Code=13 “query cancelled” UserInfo={NSLocalizedDescription=query
cancelled}
NOTE: IN XCODE 10
I’m probably not the best one to answer, because your use of
makes me think you’re using this in an ASObjC capacity and there may be things going on that I don’t understand.
But it’s been a few days without a response, so:
As vanilla applescript, if you just remove the final underscore and the “sender” argument, what you have works fine for me.
copyFile()
on copyFile()
set myFile to choose file with prompt "Choose a Kext to Install:"
set myFolder to choose folder with prompt "Choose Folder:"
tell application "Finder"
duplicate myFile to myFolder with replacing
end tell
end copyFile
Thanks for the answer but it still does not work, I’m doing this as the Action of a button in an AppleScript application in Xcode 10.1 in Mojave, in AppleScript Vanilla works fine but in Xcode it does not.
Just a wild guess here, but maybe it needs an application to parent the dialogs?
on copyFile:sender
tell application "Finder"
set myFile to choose file with prompt "Choose a Kext to Install:"
set myFolder to choose folder with prompt "Choose Folder:"
duplicate myFile to myFolder with replacing
end tell
end copyFile: