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.

Call DOS batch script in fm7 and pass variable

Featured Replies

I am looking at a way to call a DOS batch script from within Filemaker 7. I believe that I can do this using "Send Event". However, I also want to send a variable to it from one of the fields on the layout I am using and am not sure how to do this. Any help pointing me in the right direction would be greatly appreciated.

Thanks,

Jeremy B

assuming the batch script takes command-line parameters, you just create a calculation field with the exact command and parameters (from any field in the "current" record), and then use that field to invoke the Send Event.

If you use Abstrakt's great free plugin "Shell", you can also pull the results directly back into a field without resorting to writing the batch script results to a file and importing it.

Even without a plugin you can dynamically calculate and execute a bunch of commands without a batch file. Calculate the syntax in a calc or set field script step and use the Send Event to execute it

This one for example will create a little text file and then move it to another drive:

cmd /c echo "wim">c:theFile.txt && move c:theFile.txt d:

You can separate any number of commands with '&' and '&&' to have them execute one after the other ('&&' meaning the second one will only run if the first was successful).

The limitation is I believe about 8000 characters.

I prefer this approach over using an external batch file. If you want to use the batch file, use the Send Event script step to call the batch file and pass it the variables:

cmd /c c:theBatch.bat var1 var2 var3

  • Author

Hmmm, Wim I tried your method with calling the external batch file, but I seem to be having some problems.

I created a script that uses the Send Event script step. In the Send Event script step, I select text and put in the following: cmd /c c:theBatch.bat TableName::FieldName but that actually passes the value TableName::Fieldname. So I tried putting it like this: cmd /c c:theBatch.bat GetField(TableName::FieldName) but then that passes GetField.

If I do it as a calculation instead of text, it tells me that "The specified table cannot be found" in reference to cmd. So I tried putting the cmd /c c:theBatch.bat in "", but then I get the message that an operator is needed between "cmd /c c:theBatch.bat" AND "TableName::FieldName". I've tried several operators here (although it doesn't seem like an operator would go here), and I don't get any error messages, but the script doesn't actually run either.

Any ideas on how to fix this?

Thanks,

Jeremy

Your calc should look like "cmd /c c:theBatch.bat " & FieldName. If the field is in a related table, use "cmd /c c:theBatch.bat " & TableName::FieldName.

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.