Jump to content

Waiting for something to happen


This topic is 7893 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi, new to this forum topic but not the site. Hope you can help.

I am building a (FileMaker) script that creates a report, prints it to a PDF (using Acrobat writer, my client is still in OS9), then calls an applescript that selects the new pdf, renames it and moves it to a folder.

This is repeated 50 times to create 50 reports.

My problem is that some of the reports take longer than others to create than others. Due to all the calculation fields, number of records in each and time to print the PDF.

Sometimes the applescript comes back with a message similar to 'untitled is not availble' can't proced'. then the whole process falls appart and things get named wrong, and files don't make it to the destination folder.

I think I can solve it by putting something in the applescript to wait, or pause untill the new PDF is created and availible. But I am a complete applescript newbie and can't get it to work. (actually I was totally floored that how easy it was to get to the point I did get to in applescript with no help!)

Here is the script that my FM script calls;

tell application "finder"

select file 'untitled'

move selection to folder 'Weekly Reports'

selct file 'untitled' of folder 'weekly reports;

set name of selection to 'report name1.pdf'

tell application 'FileMaker Pro'

activate

end tell

end tell

I would like to add a line to say, wait untill acrobat writer is done or the untitled file is created, then continue with the applescript.

Any sugesstions?

TIA

Jerry

Link to comment
Share on other sites

Ah, one of the most fundamental problems with AppleScript, synchronization. Pardon me for not exactly answering your question, but my recommendation is to use the Troi File plug-in.

We've done a lot of moving files around. One set of scripting copies pictures files from CD's in a 9 drive tower to the local drive (50,000 images per project, 30 projects), then moves them after hours to an AppleShare server. The script has the ability to be interrupted (crash!) at any time and still recover to the point at which it left off (uses FM files on one of 5 FM servers to keep track). All this is done with Troi File (which is also cross platform).

Troi file can also find files, copy files, delete files and create thumbnail images.

-bd

Link to comment
Share on other sites

  • 2 weeks later...

After some digging and reading, I came accross the solution I was looking for. You don't need any plug ins. It isn't too hard.

All I needed was a repeat statment. (If you are gun shy, you can use repeat for 1000 times, instead of infite repeats)

The 'secret' was creating a parameter to use as a flag.

Here is the script:

repeat

try

select "Untitled"

set X_Parameter to "True"

on error

set X_Parameter to ""

end try

if X_Parameter is "True" then exit repeat

end repeat

Link to comment
Share on other sites

This topic is 7893 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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