keshalyi Posted December 4, 2002 Posted December 4, 2002 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.
keshalyi Posted December 4, 2002 Author Posted December 4, 2002 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?
jfmcel Posted December 6, 2002 Posted December 6, 2002 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.
BobWeaver Posted December 8, 2002 Posted December 8, 2002 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.
keshalyi Posted December 13, 2002 Author Posted December 13, 2002 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
jfmcel Posted December 13, 2002 Posted December 13, 2002 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.
keshalyi Posted December 17, 2002 Author Posted December 17, 2002 I tried that, but it slowed it WAY down. Oh well. Thanks anyway, everybody.
jfmcel Posted December 17, 2002 Posted December 17, 2002 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.)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now