Page 1 of 1

JobName in .bat file and %1 %2 arguments

Posted: Thu Oct 04, 2018 5:11 pm
by ChritianK
Hi again :oops: ,
Another question : I have a script I want to use with enfocus switch but didn't work...


Here is : a Java script runs on Windows with a .bat file :
"java -jar PDFCheck.jar "C:\java\IN\myfile.pdf" "valuecheck" "C:\java\OUT"
-test the .bat in command prompt , it's work OK

I would like to use it with Enfocus Switch to launch this .bat file each time a file is in input folder.

-> replace "C:\java\IN\myfile.pdf" with "%1\[Job.NameProper]" for the input file
-> replace "C:\java\OUT" with "%2" for the output directory ( the script generate a pdf with its result and place it in this directory)

So made a flow, with this .bat file:
"java -jar PDFCheck.jar "%1\[Job.NameProper]" "valuecheck" "%2" in Execute Command ( Choose folder where the .bat file is located)
Arguments : nothing / try with "%1" "%2" didn't work too
Output : Result in folder/ try other options didn't work too

I try lot of combinaison, but nothing happens, in fact I didn't really know where I must give the input and outpout destination and how I could tell to the script the name of the file...

Thanks in advance for your helps,
Christian

Re: JobName in .bat file and %1 %2 arguments

Posted: Thu Oct 04, 2018 6:06 pm
by Padawan
Hi!

Something most people don't know about Execute Command: If you enable debug logging in the Switch preferences and adjust the messages filter to make them available, then you get messages which make it a lot easier to troubleshoot the execute command. You see the command itself which is executed (after %1, %2, ... is replaced) and you also see the normal (stdout) and error output (stderr) from the command.

Is there a reason you are using a bat file also in Switch? That adds a layer of complication because you have to keep extra attention to quotes around the input and output paths when passing the paths as arguments to your bat file.

You are not using any piping or redirecting, so personally I would first try without a bat file. Something like this:
Command or path:
C:\Windows\system32\java.exe. (Please double check this, I'm on a Mac so I can't verify this)
Arguments:
-jar PDFCheck.jar "%1" "valuecheck" "%3"
Output:
Result in folder

I expect you'll get a folder with the output file(s) in it which you'll have to dismantle.

Re: JobName in .bat file and %1 %2 arguments

Posted: Thu Oct 04, 2018 6:44 pm
by ChritianK
Thanks so much for your helps, I'm going to set up Switch to enable debugging, and try your solution,
I'll answered tomorrow asap,
Best Regards,
Christian

Re: JobName in .bat file and %1 %2 arguments

Posted: Fri Oct 05, 2018 5:02 pm
by ChritianK
Hi again,
I try your suggestion, but I have a "ExecuteComandTemp" folder, empty, in output folder and no errors...
Christian

Re: JobName in .bat file and %1 %2 arguments

Posted: Sat Oct 06, 2018 9:11 am
by Padawan
Can you post what the debug messages generated by execute command are?