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

Get (Last Script) Step

Featured Replies

Is there a way to call a script from a field called "LAST SCRIPT"?

I have a database that describes different products my cabinet shop makes. A lot of the initial design parameters are called via different scripts. I run a script then typically perform some other maintenance on the file, etc.

When I am done with this maintenance I would like to be able to run the script again without having to select it from a drop down list. i.e. I would l like the computer to remember which script was last in play and run it again.

I don't want to do this with the "pause" feature within a particular script.

Is there a way to script a button to perform [color:red]GET(last script)?

Thanks for any clues here.

Jarvis

FileMaker itself does not have Perform Script [ script name as text ]. You must specify the script. Which would mean a series of IF tests. That would not be too terrible, if there were not that many scripts you wanted to call with this. It does have a Get (ScriptName) function. So you could have each script set its name into a global field. Then test for it to see which to run.

Another method, on a Mac is to use AppleScript, in a Perform AppleScript FileMaker script step. AppleScript calls FileMaker scripts by name; in fact it can ONLY call them by name (so would break if you changed a script's name).

do script FileMaker script "Some script name"

You could set the script name into an AppleScript variable, then call it:

set LastScript to field "_gScriptName" of table "Globals"

do script FileMaker script LastScript

The attached file does that. I included 2 scripts (doing the same thing) using AppleScript, to show the different methods of error capture. Either FileMaker or AppleScript can capture the error and show a dialog. In this case the AppleScript dialog is better, for a few reasons:

1. It can tell you the text of the error, not just the number.

2. It can go away after a set number of seconds.

3. It can have an icon :-]

You would want a Startup script to clear the global script name, at least before you put it up on the network.

[The Globals table is a 1-record table. We are referring to it by name, so its name must also not change. We are using "field" not "cell" because it is a global in a 1-record table. Other situations, using a regular data field, would require a different syntax.]

ScriptLastRun.fp7.zip

Edited by Guest

  • Author

Thanks Fenton,

I think for now I will try the Get(Scriptname) function.

My application has a fair number of scripts but calling them from a global field seems simple enough.

I've always been curious about Applescript.

Maybe in my next lifetime I will take that project on.

Thanks for your help,

Jarvis

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.