A previously created script that allowed me to copy to remote servers and rename folders from clipboard text using Applescript commands in Filemaker 5 no longer work in OSX Jaguar or Panther. The script will allow me to move the folder to the servers but gets this error:
Finder got an error: Can’t set name of selection to “the clipboard”.
from this script:
tell application “Finder”
activate
make new folder at folder “Active_Work_2003” of folder “Mac_Jobs” of disk “Jobs”
select folder “untitled folder” of folder “Active_Work_2003” of folder “Mac_Jobs” of disk “Jobs”
set name of selection to (the clipboard)
end tell
Is this a disconnect from the clipboard to the finder or are new commands necessary to make this work?
tell application "Finder"
activate
try
make new folder at folder "Active_Work_2003" of folder "Mac_Jobs" of disk "Jobs" with properties {name:(the clipboard)}
on error e
display dialog e
end try
end tell
That works great to create a new folder.
What I was using in the past would move “prepackaged” folders from one server to the other and rename it so that it would contain subfolders necessary to organize work as well a retain custom icons used as flags (this was an Applescript embedded in a Filemaker button script). Since OSX the moving works fine but the text in a cell in FileMaker that gets copied to the clipboard is refused by Applescript to rename the moved folder.
Actually all this requires that a folder full of prepackaged folders be maintained and fretted over… maybe all I need is to use the script you provided but create a new folder that will include subfolders named from the same script to put inside of the new folder.
Unfortunately, my attempts to do this have failed as I can’t seem to get the newly created folder to be selected by its unique name as a variable in Applescript. maybe there is a way to get Applescript to recognize it by other means so I can add new folders into it. I can live without the custom Icons since Panther doesn’t seem to use them anyway.
Again thanks for your (quick) helpful response.
Gil
I think the problem is that in OS X, you can no longer treat the Finder’s ‘selection’ as a reference to the selected items themselves. You have to ‘get’ the selection and then work on the item(s) in the returned list:
tell application "Finder"
activate
set theSelection to the selection
set name of item 1 of theSelection to (the clipboard)
end tell