Jump to content

Problems with the Do Script command


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

Recommended Posts

Here's a snippet of code from my program, after it fills all the fields in the commands, I just want it to run a FMaker script inside...

tell database "Foreign Items"

repeat with x from 1 to count of items in y1

set newrec2 to create new record in it

set cell "Foreign Item Y1" of newrec2 to (item x of y1) as real

set cell "Foreign Item X1" of newrec2 to (item x of x1) as real

set cell "Foreign Item Y2" of newrec2 to (item x of y2) as real

set cell "Foreign Item X2" of newrec2 to (item x of x2) as real

set cell "PageID" of newrec2 to pageid

go to newrec

end repeat

do script "Generate Gaps"

end tell

Problem is, after much chasing, I found it doesn't look for the script "Generate Gaps" in the database "Foreign Items" - it looks for it in whatever happens to be the active window! WHY WHY WHY? I've had more problems with the 'tell database' command... am I missing something? Don't I just type "tell database "<dbname>"?

Thanks in advance, y'all.

Link to comment
Share on other sites

BTW - as long as I have your attention, and we're discussing the do script command...

Whenever I execute a do script, the script runs, and I have to manually click on the icon for the applescript for it to continue, otherwise it just twiddles its thumbs till it times out. Thoughts?

Link to comment
Share on other sites

My experience is that AS does wait for a result after issuing do script command. But I can imagine that a script might hang up waiting for a result. Try bracketing the do script command with a

ignoring application responses

do script whatEver

end ignoring

And the AppleScript will chug merrily along.

Alternatively, you can run your script from within FM (the Perform AppleScript command in ScriptMaker) but leave the Do Script command out of you AppleScript. Just perform the subscript (Perform Script command) ScriptMaker in the step after the AS.

Link to comment
Share on other sites

Thanks both of you, unfortunately, neither suggestion solved my problem :0, but I appreciate your input. As for entering the script type into the line, it did not work, and I figured, because it IS running a FileMaker Script, just that it will ONLY run one in the topmost DB. I guess, I was wondering, do any of you have sample scripts where you activate a filemaker script in a DB that is NOT topmost?

In terms of the ignoring statement, this works, but it creates timing dificulties - I'd be using it, often, inside a loop, what if I come around the loop, and the script is still running? The two interfere with each other. That's just it. I WANT it to wait for a response, only...t he application doesn't SEND a response. SEe what I mean

Link to comment
Share on other sites

You might just need to add a freeze window command at the start of your script. Post your script (both your scriptmaker scripts and your applescripts) and I'll see if I can help.

My experience has been that calling a FM scriptmaker script within a looping AppleScript is nothing but trouble. (Placing a Do Script command at the end of an AS is fine.)

Link to comment
Share on other sites

This topic is 7825 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.