osx - Moving files in Applescript, got error: "Finder got an error: Handler can’t handle objects of this class." -
i trying move files using applescript, , error every time run app. in contents of app, have file(s) want move (so if distribute app users won't have separately download file(s)). why using ((path home folder text)
, adding specific file path past that. here code:
set source ((path home folder text) & "/contents/resources/finder.jpg") set source2 ((path home folder text) & "/contents/resources/finder@2x.jpg") set destination alias "macintosh hd:system:library:coreservices:dock.app:contents:resources:" tell application "finder" move source destination replacing move source2 destination replacing end tell
p.s. checked every related question/answer there on here, , none helped.
a simple display dialog source
have led solution:
path home folder
returns alias home folder (macintosh hd:users:your name:). think wantedpath me
instead points app.analias text
returns path string using : delimiters , append parts use / delimit path componentsanalias text
returns path string ends : in case of directories
summary: try
set source ((path me text) & "contents:resources:finder.jpg")
update: can't use alias ...
, better use ... alias
, think, maybe duplicate
better here...
set source ((path me text) & "contents:resources:finder.jpg") alias set source2 ((path me text) & "contents:resources:finder@2x.jpg") alias set destination "macintosh hd:system:library:coreservices:dock.app:contents:resources:" alias tell application "finder" duplicate source destination replacing duplicate source2 destination replacing end tell
enjoy, michael / hamburg
Comments
Post a Comment