December 4, 200223 yr 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.
December 4, 200223 yr Author 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?
December 6, 200223 yr 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.
December 8, 200223 yr 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.
December 13, 200223 yr Author 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
December 13, 200223 yr 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.
December 17, 200223 yr Author I tried that, but it slowed it WAY down. Oh well. Thanks anyway, everybody.
December 17, 200223 yr 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.)
Create an account or sign in to comment