May 7, 200124 yr Hi. I don't know any applescript but I would be extremely grateful if you could help me. I have a database called Users.fp5 with a field called "UserID". Do you know how to create an applescript which can automatically create a new folder everytime a new record is created in the Users.fp5? And each new folder is named the "UserID" of that particular new record. Thank you for your time.
May 7, 200124 yr I tried to reply to your earlier post a couple of days ago, and somehow the entire topic vanished. Sorry about that. You'll have to control the creation of records by means of a button which executes a script so that you can run an applescript when the new record is created. The following example shows how to create a folder and, rename and move files. Specifically, it creates a new folder inside the images folder. The new folder name is taken from the field gFolderName in the current filemaker file. It then takes a file called ExportFile in the FMDefaultExport folder renames it to the name taken from field gFileName, and then moves it to the newly created folder. This is useful for files exported from filemaker whose export name and location you normally have no control over when scripting. You should be able to adapt this for your purposes. code: tell app "FileMaker Pro" set NewName to cell "gFileName" set FolderName to cell "gFolderName" end tell tell application "Finder" make new folder at folder "MacHD:images" with properties {name:FolderName} set name of item "ExportFile" of folder "MacHD:FMDefaultExport" to NewName move item NewName of folder "MacHD:FMDefaultExport" to folder ("MacHD:images:" & FolderName) end tell
May 7, 200124 yr Author Hello.... I figured out how to create all those applescripts that I needed so that I could create folders.... thanks. I don't know if anyone knows about using scripts via the web and CDML.... Well, I have an online form which creates a new record in the Users.fp5 database and this form also includes the "-script" tag: <input type=hidden name=-Script value=UserIDFolder> The script does work when I submit my online form (to create a new user record) but only if my Users.fp5 database is at the front of FileMaker when I press the submit (-new) button. If another database happens to be at the front of FileMaker when I press the submit (-new) button then the script is ignored even though the Users.fp5 database comes to the front to create the new record. How do I get my script to work even if another database happens to be at the front of FM Pro when I press the submit button? .....thanks for all your help!
May 10, 200124 yr Change the line: tell app "FileMaker Pro" to: tell database "Users.fp5" of app "FileMaker Pro"
Create an account or sign in to comment