Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Scripting a file name


Darby Darrow

Recommended Posts

Hello All,

 

I am using FMP8.5 Dev Edition. I would like to automate the exporting of records for a user. I script it so that the record is exported, but would like to automate the naming of the file from a field in the record. I can see where I can set the file path, but I don't know how to automatically name the file in the export dialog box. I can copy the info from the field to the clipboard and have the user paste, but would like to leave that step out of the user's hands. Is there a way in either 8.5 or FMP9?

 

Thanks in advance.

 

Darby

Link to comment
Share on other sites

In the box where you set the filepath, supply a script variable

 

so

 

set variable [ $path ; table::Filepath ]

export records [ "$path" ; macintosh ]

Link to comment
Share on other sites

Perhaps I was not clear. I don't want to set the file path. I would like the user to choose their own place to save the file. I would like to name the file for them.

Link to comment
Share on other sites

I know how to do that for mac only using an applescript. I assume VB could do the same for windows to make this xplat but I am clueless as to that. Anyway here's the mac-only script in a tiny demo. UserSelectFilePath.fp7.zip

 

PS edit: I just discovered that the applescript will generate a list of all files in all subfolders of the selected folder too. Which will result in false positives when testing if the filename already exists. The applescript should run (edit in red):

 

tell application "Finder"
   set selectedFolder to choose folder with prompt ¬
       "Choose folder."
  [color=Red] set filelist to (name of every file of selectedFolder) as list[/color]
end tell
tell application "FileMaker Pro Advanced"
   activate
   set data of cell "UserSelectFilePath::gList" to filelist as string   
      set data of cell "UserSelectFilePath::gPath" to selectedFolder as string
end tell

Link to comment
Share on other sites

KJoe,

 

Thanks for the Applescripting reply. Unfortunately only two of us using the file they rest will be using Windows and I have no desire to make it happen in VB. I will probably just have them name it manually.

 

Darby

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use