I’m currently trying to get this script to work…it was fine, until I changed the directories to look inside the app resources folder. Not sure why that would make Finder throw the error that the handler can’t handle objects of this class, but that’s what happens. I feel like I’m so close but so far lol Here’s the problem excerpt from my script:
tell application "Finder"
set floTools to POSIX path of (path to me) & "Contents/Resources/Flo Tools.kmmacros"
set templates to POSIX path of (path to me) & "Contents/Resources/Flo Tools"
set source to templates
set destination to POSIX path of (path to library folder from user domain) & "Application Support"
duplicate source to destination with replacing
end tell
Got it, thank you so much. For reference, my script now looks like this:
tell application "Finder"
set floTools to (path to me) & "Contents:Resources:Flo Tools.kmmacros" as text
set templates to (path to me) & "Contents:Resources:Flo Tools" as text
set source to templates
set destination to (path to library folder from user domain) & "Application Support" as text
duplicate source to destination with replacing
end tell
You can’t duplicate paths. The way you’re forming them is also potentially problematic. Try this:
set templates to (path to me as text) & "Contents:Resources:Flo Tools"
set destination to (path to library folder from user domain as text) & "Application Support"
tell application "Finder"
duplicate folder templates to folder destination with replacing
end tell
If you have installed the free BridgePlus.scptd library you may use :
use scripting additions
use framework "Foundation"
use script "BridgePlus"
load framework
set templates to (path to me as text) & "Contents:Resources:Flo Tools"
set destination to (path to library folder from user domain as text) & "Application Support:Flo Tools"
set {theResult, theError} to (current application's SMSForder's copyItemAt:(POSIX path of templates) toItem:(POSIX path of destination) replace:true |error|:(specifier))
if theResult as boolean is false then error (theError's localizedDescription() as text)
use scripting additions
use framework "Foundation"
use FMLib : script "FileManagerLib"
set templates to (path to me as text) & "Contents:Resources:Flo Tools"
set destination to (path to library folder from user domain as text) & "Application Support:"
FMLib's copyItem:(POSIX path of templates) intoFolder:(POSIX path of destination) withReplacing:true
Yvan KOENIG running Sierra 10.12.1 in French (VALLAURIS, France) dimanche 20 novembre 2016 18:53:39