Jump to content

how to change exported filename via apple script


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

Recommended Posts

Hi there,

I want to cahnge my exported file's name by any text in my global field in FileMaker.

For windows version i am using dos commands (ren command) to change filename after i exported from filemaker.

It is works but now my problem is mac version how can i change exported file name? New file name should be get from filemaker field.

Apple script can help me? But i don't know Apple Script. Can anybody help me?

Thanks

Adam

Link to comment
Share on other sites

It's pretty easy to do, using a Perform AppleScript step. But you'll have to try it on a Mac to test.

--tell application "FileMaker Developer"

set fixedFile to cell "FixedFile"

set fileName to cell "FileName" of current record

tell application "Finder"

set name of file fixedFile to fileName

end tell

--end tell

Explanation:

fixedFile is global or unstored calculation with the full Mac path of the Export file. What this should be depends on whether this is on a standalone computer, in which case a relative path will work, or whether it's on a networked solution, in which case you'd want to use the common Shared folder.

In either case you could alternatively use an invalid path, in which case the file will end up in the FileMaker application folder; but only if the user has permissions, which they might not.

A Mac path (for AppleScript) is the old style, with colons (spaces are OK):)

Macintosh HD:Users:Shared:Export.pdf

What fixed path method are you using on Windows?

fileName is just a simple file name, in the current record of the current FileMaker layout. It's easiest to just go to that layout first. You can also specify the layout:

set fileName to cell "FileName" of current record of layout "Rename"

-- is a commented line in AppleScript

--tell application "FileMaker Developer"

and

--end tell

lines are not needed in a Perform AppleScript step, unless nested inside another app's tell block.

FileMaker knows who it is. But they are needed, uncommented, in the Script Editor app, which is the AppleScript editor that comes with Macs.

Link to comment
Share on other sites

This topic is 6890 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.