Simplidata Posted October 17, 2015 Posted October 17, 2015 I an trying to run a batch file using RunShellScript on Windows Server 2008 R2, FM13 - ScriptMaster 4.4.2. The code is as follows: RunShellScript( $Folder_Dossier_Path & "batch.bat"; "true" ; "30" ) The variable is simply the path to the batch file. If I double-click the batch file it works but within the script I get the following error message: java.lang.RuntimeException:Process was terminated. Other ScriptMaster functions are all working well and they use the same variable so I know it's OK. I'm a Mac guy so perhaps I'm missing something?
john renfrew Posted October 17, 2015 Posted October 17, 2015 Are you sure it is the OS version of the path??
Simplidata Posted October 17, 2015 Author Posted October 17, 2015 Yes. I have other parts of the script using the same path without any issues. I first move some files there, including the batch file. Then I need to run the batch file. It tells another application to process the files I moved.
sal88 Posted October 19, 2015 Posted October 19, 2015 have you trimmed down the batch file? perhaps there's just something in there that SM doesn't like returning. Does it run if you set the 'wait for result' parameter to 'false'?
Simplidata Posted October 19, 2015 Author Posted October 19, 2015 Yes, I tried both true and false and also increased the timeout to 60. Nothing worked. In the end, I used FileMaker's built-in send event command to trigger the batch file. I don't know why ScriptMaster threw the error but I've given up on it. Thanks for the responses.
Jesse Barnum Posted October 19, 2015 Posted October 19, 2015 What was the actual value returned for: $Folder_Dossier_Path & "batch.bat"
Simplidata Posted October 19, 2015 Author Posted October 19, 2015 (edited) The full path is: G:\ENTRÉE\2015\Octobre\SNC79085\batch.bat This is running on a French system (hence, the accents). We have used this same path variable in several other ScriptMaster actions without any issues. For example, the folders "2015\Octobre\SNC79085" are created using the ScriptMaster CreateFolder command. The batch file itself is also created and placed in this folder by ScriptMaster. Yet the RunShellScript won't trigger the batch file. As I said in my previous post, I've solved this by using the Send Event script step. Edited October 19, 2015 by Simplidata typos
Jesse Barnum Posted October 19, 2015 Posted October 19, 2015 I'm glad you got it figured out with Send Event. I think the reason it's failing is because RunShellScript is designed to take its input as an actual set of instructions to run, not the path of a file to execute. If you wanted to pass in the path of a file then it might work to do 'CMD.exe /C <pathToFile>'. Of course, the way you're doing it now works as well.
Simplidata Posted October 19, 2015 Author Posted October 19, 2015 Thanks. That's interesting. From what you're saying, the batch file content itself could be inside the RunShellScript function. No need to actually write the batch file to disk first?
Simplidata Posted October 20, 2015 Author Posted October 20, 2015 To follow up, thanks for the info about how the RunShellScript works. As it happens, I have to run the script from FileMaker Server and the send event script step doesn't work for fmserver (should have noticed that earlier ;-) Fortunately, ScriptMaster does. I plugged in my batch file contents and it works great! Thanks Jesse, Harold
Jesse Barnum Posted October 25, 2015 Posted October 25, 2015 Harold, thanks for letting me know, that's great news!
ggt667 Posted October 25, 2015 Posted October 25, 2015 This may or may not; depending on what your .bat file does, be a better way to solve your case: http://wethecomputerabusersamongst.blogspot.com/2013/10/execute-php-script-from-filemaker-with.html
Simplidata Posted October 26, 2015 Author Posted October 26, 2015 Hi ggt667, Thanks for the link. I'll take a look at it.
Recommended Posts
This topic is 3585 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 accountSign in
Already have an account? Sign in here.
Sign In Now