Re: How to make AppleScript wait for FileMaker to complete a script? SOLVED
Re: How to make AppleScript wait for FileMaker to complete a script? SOLVED
- Subject: Re: How to make AppleScript wait for FileMaker to complete a script? SOLVED
- From: Dennis Jones <email@hidden>
- Date: Thu, 31 Mar 2005 14:41:45 -0800
I ended up using a 'do shell script' to clear a flag in an external
file, then had FileMaker set the flag when it was done. The FMP script
was "Perform AppleScript 'do shell script "echo 1 > ~/temp/flag.txt"".
In the mean time, AS was in a repeat loop looking for the flag. See
code below. I have omitted extra code.
This solution may not be cross platform but works on OS X 10.3.8
Dennis
email@hidden
on getImportFiles(sourceFolder, importFile, importFolder, scriptToRun,
file_to_open)
-- code omitted --
repeat with i from 1 to number of items in the itemList
clearFlag() --set flag to 0
-- code omitted --
do shell script "sleep 1"
tell application "FileMaker Pro 6"
do script scriptToRun
end tell
repeat
if getFlag() = "1" then
exit repeat -- when flag is 1, continue
else
do shell script "sleep 5" -- wait awhile and try again
end if
end repeat
end if
end repeat
deleteFlag() -- clean up temp file
end getImportFiles
on getFlag()
return do shell script "cat ~/temp/flag.txt"
end getFlag
on clearFlag()
do shell script "echo 0 > ~/temp/flag.txt"
end clearFlag
on deleteFlag()
do shell script "rm ~/temp/flag.txt"
end deleteFlag
-- end code
On Thu, 31 Mar 2005 08:57:35 -0800, Dennis Jones <email@hidden> wrote:
> In the AppleScript below, I need to make the AS script wait while a
> FileMaker script runs. The duration of the FM script varies from a few
> seconds to over a minute.
>
> At present, some import files are replaced before FileMaker can import
> and process them.
>
> Is there something I can replace the 'sleep 10' command with that will
> monitor FileMaker and let AS know when it can continue the loop.
>
> --
> Dennis Jones
> email@hidden
>
> -- code --
>
> on getImportFiles(sourceFolder, importFile, importFolder, scriptToRun)
> set the itemList to list folder sourceFolder without invisibles
> set sourceFolder to sourceFolder as string
> set search_string to "CATHY-H"
> repeat with i from 1 to number of items in the itemList
> set thisItem to item i of the itemList
> set thisItem to (sourceFolder & thisItem) as alias
> set thisInfo to info for thisItem
> -- Set file name to currentName
> set the currentName to the name of thisInfo
> if folder of thisInfo is false and ¬
> alias of thisInfo is false and ¬
> currentName contains the search_string then
>
> copyToImportFolder(sourceFolder, importFolder, importFile, currentName)
>
> tell application "Finder"
> update folder importFolder with necessity
> end tell
>
> do shell script "sleep 1"
>
> tell application "FileMaker Pro 6"
> do script scriptToRun
> end tell
>
> do shell script "sleep 10" -- Needs to be "Wait until FileMaker is done"
>
> end if
> end repeat
> end getImportFiles
>
--
Dennis Jones
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden