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.

Featured Replies

I have a script I would like to execute with a button click.  The script works fine, but I would like to pass two variables into the script.  I'm not sure how to do this, but I've been trying to use the Specify Calculation to do this.

 

The following is the script:

 

I would like to replace the fun and the 000000 with information from the database.  Could anyone point me in the correct direction, or provide a hint for me.

 

 

do shell script "osascript NewFromTemplatePlaceImage.scpt fun 000000"

 

Regards,

  • Author

I've tried to use Set Variable [$variable ; ] but I get an error "The specified table cannot be found"

do shell script "osascript NewFromTemplatePlaceImage.scpt fun 000000"

 

Try it like this:

Set Variable [ $AS ; "do shell script " & Quote ( "osascript NewFromTemplatePlaceImage.scpt " & YourTable::fieldForFun & " " & YourTable::fieldFor000000 ) ]
Perform AppleScript [ calculated: $AS ]
  • Author

Thank you for the help.  When I try and save this it gives me the same message: The specified table cannot be found, and it highlights "Set Variable"

It sounds like you have a bad relationship.

  • Author

The only relationship I have setup is an order number field  between two tables.

I've tried to use Set Variable [$variable ; ] but I get an error "The specified table cannot be found"

 

Set Variable[] is a script step. The error you show is a calculation syntax error. You cannot type script steps into a formula - that just makes no sense.

 

I would like to replace the fun and the 000000 with information from the database.  Could anyone point me in the correct direction, or provide a hint for me.

 

 

do shell script "osascript NewFromTemplatePlaceImage.scpt fun 000000"

 

What exactly is the Filemaker script step that you are calling here?

  • Author

Well I'm clearly confused.  I have a button that I want to trigger the script above.  This script needs a few items of information from the FileMaker tables to function.

 

I have created a button and when setting it up I have chosen the perform applescript script option.  Then I am presented with 2 options.  1.) Calcuated Applescript 2.) Native applescript

 

I've tried to use both, but maybe I'm totally down the wrong path.

 

Sorry for my ignorance.

Please read up on the difference between Script steps and calculations, and how they work in tandem.

 

If you attach a script to your button you can define several steps; one of these could be a Set Variable[] step that calculates the AppleScript code, the next one the Perform AppleScript[] step that also uses a calculation – but this calculation is then simply a reference to the previously defined variable and returns its (the variable's) value, i.e. your code. As shown above:

Set Variable [ $AS ; "do shell script " & Quote ( "osascript NewFromTemplatePlaceImage.scpt " & YourTable::fieldForFun & " " & YourTable::fieldFor000000 ) ]
Perform AppleScript [ calculated: $AS ]

 

If you attach a step directly to a button, you can only perform this one single step; so you need to select the Perform AppleScript[] step, and – since now you have no intermediate Set Variable[] – calculate the result (.i.e the code) directly in the Edit dialog you get when you click the “Calculated AppleScript” option.

Perform AppleScript [ calculated: "do shell script " & Quote ( "osascript NewFromTemplatePlaceImage.scpt " & YourTable::fieldForFun & " " & YourTable::fieldFor000000 ) ]

Maybe it is a bit confusing …  :turned:

Why not attach  a copy of your file?

  • Author

Wow thanks eos! Finally I see some progress.

 

If I want to use the values from a selected portal row, how would I designate that instead of the table entries?

If by “selected” you mean “the portal row I click a button in“, then you can simply refer to the fields from the TO of the portal (actually, the relationship branch …); as an illustration:

 

On an Orders layout, clicking a button (entering a field) in row #2 of a line items portal lets you refer to that related record; so LineItems::qty returns 6, and LineItems::priceExtended 4.20, while #3 would give you 4 and 6, respectively (and the total is a bit more complicated ). You get the drift …

Order # 283,376,492

Product               qty    ext.
---------------------------------
Portal to go           4     3.20
Variables (local)      6     4.20
Relationship de jour   4     6.00
Functions (custom)     5     5.75
---------------------------------

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.