May 24, 201510 yr I am trying to use Send Event to create a BAT file on my Desktop.I have used the Send Event before and believe this should be possible using this script step.I have this:Set Variable [$file ; get (desktoppath ) & "test.bat"]Send Event ["aevt" ; "odoc" ; "cmd /c echo test> " & $fileWhich I would expect to create the file test.bat on my Desktop with the word 'test', as when I run this from cmd in any directory it creates the file as expected. However this isn't working using Send Event.I used Substitute to change the \ in the filepath to / but it also didn't work.Any help would be great thanks!
May 24, 201510 yr Your Send Event does not target the test.bat, you have to specify the full path to your test.bat file (and for good measure also specify the ".bat" extension). If your batch file is not too complex you don't need to create a batch file in the first place. You can do something like this: cmd /c command1 && command2 && command3 ...
May 24, 201510 yr Author you have to specify the full path to your test.bat file.. Thanks for your reply!I have created the variable $file with the full path name, so I don't quite understand.Effectively I am doing this:Send Event ["aevt" ; "odoc" ; "cmd /c echo test> " & get ( desktoppath ) & "test.bat"
May 24, 201510 yr Your $file variable holds the path in FM format, not the format that Windows understands. The variable will be something like: file:/c:/<somewhere> but windows expects c:\<somewhere> So you have to do the proper substitutions...
May 24, 201510 yr Author Your $file variable holds the path in FM format, not the format that Windows understands. The variable will be something like: file:/c:/<somewhere> but windows expects c:\<somewhere> So you have to do the proper substitutions... I also stated that I tried using Substitute / for \ and it still didn't work
May 24, 201510 yr Why don't you test the expression in the Data Viewer and compare its result with the shell command that works?
May 24, 201510 yr Author So now the next issue I am having is I have the template for the BAT file stored in a field, which I then replace the keywords with the parameters and want to construct that file.The problem is - The 'Batch' field has multiple lines, but when it creates the file it does not put the new lines in and in turn causes the file to not work.Do you know anything about this?By multiple lines, I mean separated by carriage return. Edited May 24, 201510 yr by MattyM
Create an account or sign in to comment