Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Posted

There may also be a problem with syntax. I think you have to use this form:

do script FileMaker script "Generate Gaps"

otherwise it may be thinking that you are trying to run another applescript rather than a filemaker script.

Posted

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

Posted

You need to set up the loop within a scriptmaker script and call the applescrpt as a subscript from your scriptmaker script, not the other way around.

Posted

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.)

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