Jump to content
Sign in to follow this  
Krishan

new folder created with each new record

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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


Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

Change the line:

tell app "FileMaker Pro"

to:

tell database "Users.fp5" of app "FileMaker Pro"

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    PathGeek 
×
×
  • Create New...

Important Information

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