This has to be something simple that I am missing. I can't get a simple command line program to run.
This script is below. I put the Message box in so I could copy and paste the line in the command prompt. When I do it works. If I run it from Macro Scheduler I get no output.
I have tried rebooting etc. I normally use longer file paths and things in variables but I stripped them all out and I still can't get it to run. It is not only happening with this executable but on some others as well. Any ideas?
Oh yeah I also tried it with a cmd /c after the RunProgram as well.
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
ChangeDirectory>c:\temp
MDL>"c:\temp\pdfinfo.exe" "c:\temp\test.pdf"|find "Pages:" > "c:\temp\numpages.txt"
RunProgram>"c:\temp\pdfinfo.exe" "c:\temp\test.pdf"|find "Pages:" > "c:\temp\numpages.txt"
Having issues with RunProgram
Moderators: Dorian (MJT support), JRL
Re: Having issues with RunProgram
Hi Keith,
I'd try a "cmd /k" to be able to see what fails. The "/k" will leave the DOS box open.
RunProgram>cmd /k "c:\temp\pdfinfo.exe" "c:\temp\test.pdf"|find "Pages:" > "c:\temp\numpages.txt"
I'd try a "cmd /k" to be able to see what fails. The "/k" will leave the DOS box open.
RunProgram>cmd /k "c:\temp\pdfinfo.exe" "c:\temp\test.pdf"|find "Pages:" > "c:\temp\numpages.txt"
Re: Having issues with RunProgram
Thanks
Now I get a
The filename, directory name, or volume label syntax is incorrect.
You would think the same syntax would work. I can get this to work, but if I put the output path in quotes for a space in the path it fails. Also if I separate the program and the pdf path in quotes it fails.
I'm wondering if it is like the old comma issue where you had to have let>comma=, and then when you wanted to use one you used %comma%
Run>cmd /k "c:\temp\pdfinfo.exe c:\temp\test.pdf" > c:\temp\numpages.txt
Now I get a
The filename, directory name, or volume label syntax is incorrect.
You would think the same syntax would work. I can get this to work, but if I put the output path in quotes for a space in the path it fails. Also if I separate the program and the pdf path in quotes it fails.
I'm wondering if it is like the old comma issue where you had to have let>comma=, and then when you wanted to use one you used %comma%
Run>cmd /k "c:\temp\pdfinfo.exe c:\temp\test.pdf" > c:\temp\numpages.txt
Re: Having issues with RunProgram
My experience with spaces in paths and file names has been that RunProgram> and ExecuteFile> do not need quotes. If you use RunProgram> with a cmd you do need quotes around paths and names with spaces in them.
Re: Having issues with RunProgram
I'll try that next. In the past I have not had the same results though. What I have always done is tested it in the command line utility and then put the same in the script. It should be passed to the command line prompt the same way.
However it is not as I can display the line and then copy and past it in the command line utility and have it fail.
However it is not as I can display the line and then copy and past it in the command line utility and have it fail.
Re: Having issues with RunProgram
I tried it without the quotes and it failed. I just don't get why it is passed to the command line utility differently and it is or it would work. We are not at this point putting any variables in this is just text with no spaces in the paths which is not real useful as I need spaces in the paths.
For what it is worth the utility I am try to use is a free tool for processing pdf files. It is called xpdf and they have bunch of tools that you can download.
For what it is worth the utility I am try to use is a free tool for processing pdf files. It is called xpdf and they have bunch of tools that you can download.
Re: Having issues with RunProgram
I think there's something weird about "pdinfo.exe". I think the message "The filename, directory name, or volume label syntax is incorrect." is being generated by "pdinfo.exe". To help your sanity, the program is not following the rules. Made me crazy too.
In any case I got it to work WITH spaces in the path by running it from a batch file. If you still have the files in your "c:\temp\" folder the following will make a subfolder "Try Again" and copy the needed files there and run them from the "c:\temp\Try Again\" folder. The batch file still puts "numpages.txt" in the "c:\temp\" folder.
In any case I got it to work WITH spaces in the path by running it from a batch file. If you still have the files in your "c:\temp\" folder the following will make a subfolder "Try Again" and copy the needed files there and run them from the "c:\temp\Try Again\" folder. The batch file still puts "numpages.txt" in the "c:\temp\" folder.
Code: Select all
CreateDir>c:\temp\Try Again
Let>cf_overwrite=1
CopyFile>c:\temp\pdfinfo.exe,c:\temp\Try Again\pdfinfo.exe
CopyFile>c:\temp\test.pdf,c:\temp\Try Again\test.pdf
Wait>1
DeleteFile>c:\temp\Try Again\pdfinfo.bat
DeleteFile>c:\temp\numpages.txt
Let>RP_WAIT=1
Let>RP_WINDOWMODE=1
WriteLn>c:\temp\Try Again\pdfinfo.bat,wres,"c:\temp\Try Again\pdfinfo.exe" "c:\temp\Try Again\test.pdf" |find "Pages:" > c:\temp\numpages.txt
RunProgram>c:\temp\Try Again\pdfinfo.bat