Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problems with the Do Script command

Featured Replies

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.

  • 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?

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.

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.

  • 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

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.

  • Author

I tried that, but it slowed it WAY down. Oh well. Thanks anyway, everybody.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.