Hello red_menace,
Thank you very much for testing.
Oh well, I may have missed something very basic here but now I give up.
Regarding Automator's 'call method' command, the Automator Programming Guide has brief description.
cf.
Automator Programming Gudie > Implement an AppleScript Action
pp.64, 66 (PDF version)
http://developer.apple.com/documentation/AppleApplications/Conceptual/AutomatorC oncepts/
It also states that (in p.66) -
"Sometimes, an AppleScript Studio script does not have access to a valid object for a call method command."
So I suspect this may be the reason why my attempt falis.
---
By the way, AppleScript Studio has 'load image' command for creating NSImage object from file.
E.g., my failed codes using Automator can be translated into something like the following one, which should work, I'd think.
--CODE (for AppleScript Studio script)
set srcpath to POSIX path of (choose file with prompt "Choose source image file.")
set dstpath to POSIX path of (choose folder with prompt "Choose target folder.")
--set dstpath to dstpath's text 1 thru -2 -- remove last slash if necessary.
setIcon(srcpath, dstpath)
on setIcon(srcpath, dstpath)
set nsimg to load image srcpath
set nswks to call method "sharedWorkspace" of class "NSWorkspace"
set r to call method "setIcon:forFile:options:" of nswks with parameters {nsimg, dstpath, 0}
delete nsimg
return r
end setIcon
--END OF CODE
cf.
AppleScript Studio Terminology Reference
http://developer.apple.com/documentation/AppleScript/Reference/StudioReference/
All the best,
Hiroto