Jump to content

Change a filename before inserting in FM


This topic is 6645 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi all,

I've been trying all afternoon to get this to work but I'm finally ready to throw in the towel and ask for help on this one. Here's the scenario:

I need to insert files into a container in FM, but they need to have their names changed before I insert them. I have all my fields and variables holding the correct info but I can't get the AppleScript to work, This is what I've got so far..

"Tell application "  & Quote ( "Finder" ) & ¶ & 



"set name of file " & $filePath & " to " & $newFileName & ¶ & 



"end tell"

$filePath is called out with colons, like "Mac:users:me:NameOfFile.pdf"

$newFileName is called out like "ChangedNameOfFile.pdf"

(all sans quotations)

I'm certain it's my syntax in the AppleScript but I can't figure out where the problem lies.

Thanks in advance for any help offered!

Edited by Guest
Link to comment
Share on other sites

A couple things. First, you're using the "local to this script only" syntax for your variables. Apparently they aren't available to the calculation, as it won't work. Use "$$" instead.

You also need to somehow get quote marks around your filepath and your file name, as they are text. This works:

"tell application " & Quote ( "Finder" ) & ¶ &

"set name of file " & Quote ($$filePath) & " to " & Quote ($$newFileName) & ¶ &

"end tell"

Link to comment
Share on other sites

This topic is 6645 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.