Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7284 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

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.

This topic is 7284 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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