I have a button on a FileMaker form that I want to use to create a new folder within the documents/jobhunt folder. This is one of those things that you’d think would be easy to accomplish, but there is no command within FileMaker scripting to do it. One solution is to use the FileMaker script step [Perform Applescript], and execute the following Applescript. Note that the dialog which allows you type in a folder name is an AppleScript dialog not a FileMaker dialog.
What is happening within the script, is the following:
1. Displays a dialog to choose a folder name
2. Copy the folder name to a variable text_returned
3. Assign the path of the user’s Documents folder to the variable p.
/Users/lkeyes/Documents
4. Append the existing JobHunt folder to the path
/Users/lkeyes/Documents/Job Hunt
5. Create a new folder within the “Job Hunt” folder with the name myfolder.
Here is the code from the FileMaker Script:
copy the result as list to {text_returned, button_pressed}
set p to path to documents folder as string set p to p & “Job Hunt:”
tell application “Finder”
make new folder at p with properties {name:text_returned}
end tell ]
Here is the code from the Applescript Editor: