December 15, 200421 yr 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
December 16, 200421 yr 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.
December 16, 200421 yr 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
December 17, 200421 yr 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
December 17, 200421 yr 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