Jump to content
Sign in to follow this  
dburnham

Folder action to trigger FP5 script

Recommended Posts

I hope someone has the answer for this. I want to create a watched folder by writing an Applescript that is attached to a folder with folder actions. The script will tell Filemaker Pro to run a a particular script.

When I write a script that simply says:

tell application "FileMaker Pro"

do script "import_textfile"

end tell

it works if I just run the script manually, but when I make it a folder action and drop the file "textfile" into the folder, nothing happens.

Help, please. thanks in advance.

Share this post


Link to post
Share on other sites

Two things: be careful about you syntax and keep the folder open. Experiment with example scripts (available from Apple). Something like this

on adding folder items to this_folder after receiving the_items

--Your script here

end adding folder items

handler.

Folder actions will only work if the folder is open. (You can add a keep open subroutine to your folder script, also found in the Apple sample scripts.)

Share this post


Link to post
Share on other sites

Here is part of a folder action script that I wrote to import a tab-delimited file into a FileMaker Pro 5.0 database. On adding a new file to a folder, the script will make sure FileMaker Pro is running, then open the database that I've hard-coded, and run the script.

tell application "Finder"

activate

set the selection to the added_items

repeat with i from 1 to the number of items in the added_items

set this_item to (item i of the added_items)

try

select file "CCS.Jackson.fmp" of desktop -- CHANGE THIS TO MATCH THE FILEMAKER DATABASE NAME OF YOUR CHOICE

open selection

tell application "FileMaker Pro"

activate

do menu menu item "Import Records" of menu "Scripts" --THIS CALLS THE FILEMAKER SCRIPT THAT YOU CREATE

end tell

on error

display dialog "Something bad happened, and I'm not happy about it!!"

end try

end tell

end repeat

end tell

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  

×
×
  • Create New...

Important Information

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