Jump to content

HELP - Dos command execution - What is the right syntax ?


Recommended Posts

Hi all,

i'm struggling with the PDFCreator command line, i'm sure the answer must be obvious ... but i don't find any wayout ...

i try to make the following code work :

$commandName="C:\Program Files\PDFCreator\PDFCreator.exe -IF" & $source &  " -OF" & $destination
RunWait(@ComSpec & " /c " & $commandName, "", @SW_HIDE)

The problem must be linked with the space contained in the PDFCreator path but i can't find the right syntax ...

Could any help me ?

Thanks in advance.

Link to comment
Share on other sites

Hi all,

i'm struggling with the PDFCreator command line, i'm sure the answer must be obvious ... but i don't find any wayout ...

i try to make the following code work :

$commandName="C:\Program Files\PDFCreator\PDFCreator.exe -IF" & $source &  " -OF" & $destination
RunWait(@ComSpec & " /c " & $commandName, "", @SW_HIDE)

The problem must be linked with the space contained in the PDFCreator path but i can't find the right syntax ...

Could any help me ?

Thanks in advance.

$commandName='"C:\Program Files\PDFCreator\PDFCreator.exe" -IF' & $source &  ' -OF' & $destination
RunWait(@ComSpec & " /c " & $commandName, "", @SW_HIDE)
Link to comment
Share on other sites

thanks for help ...

It executes PDFCreator but my *.pdf files are not generated ... i suppose it has to do with PDF Creator options (?) ... my *.ps files are normal and generate the right *.pdf when launched manually ...

does the auto-save option of PDF Creator have to be set ?

thanks.

Link to comment
Share on other sites

thanks for help ...

It executes PDFCreator but my *.pdf files are not generated ... i suppose it has to do with PDF Creator options (?) ... my *.ps files are normal and generate the right *.pdf when launched manually ...

does the auto-save option of PDF Creator have to be set ?

thanks.

Well.. comspec only accepts so many quotes.. have you tried without comspec? maybe you need quotes around input file and output file?

$commandName='"C:\Program Files\PDFCreator\PDFCreator.exe" -IF"' & $source &  '" -OF"' & $destination & '"'
RunWait($commandName, "", @SW_HIDE)
Edited by azure
Link to comment
Share on other sites

thanks for help ...

It executes PDFCreator but my *.pdf files are not generated ... i suppose it has to do with PDF Creator options (?) ... my *.ps files are normal and generate the right *.pdf when launched manually ...

does the auto-save option of PDF Creator have to be set ?

thanks.

Are you sure there isn't supposed to be a space between "-IF" or "-OF" and the file paths? I would have tried that like:
$source = FileGetShortName('C:\My Dir\My Sub Dir\My File.doc')
$destination = FileGetShortName('C:\My Dir\My Sub Dir\My File.pdf')
$sPDFC_Dir = 'C:\Program Files\PDFCreator'
$commandName = '"' & $sPDFC_Dir & '\PDFCreator.exe" -IF ' & $source & ' -OF ' & $destination
RunWait(@ComSpec & ' /k ' & $commandName, $sPDFC_Dir, @SW_SHOW)

Note "/k" and "@SW_SHOW" for testing so any errors can be seen. These can be changed back after it works. FileGetShortName() gives you 8.3 paths to work with.

If this still doesn't work, you need to post a working command line you have tested manually so we can see what works before translating it into AutoIt.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I would go with one of the following two options...

Local $commandName = "C:\Program Files\PDFCreator\PDFCreator.exe -IF '" & $source & "' -OF '" & $destination & "'"
RunWait('"' & $commandName & '"', "", @SW_HIDE)oÝ÷ ØäZºÚ"µÍØØ[    ÌÍØÛÛ[X[[YHH   ][ÝÐÎÌLÔÙÜ[H[ÉÌLÔÜX]ÜÌLÔÜX]Ü^HRQ    ÌÎNÉ][ÝÈ   [È ÌÍÜÛÝÙH   [È ][ÝÉÌÎNÈSÑ    ÌÎNÉ][ÝÈ   [È ÌÍÙÝ[][Û   [È ][ÝÉÌÎNÉ][ÝÂ[ØZ]
ÛÛTÜXÈ  [È ][ÝÈØÈ  ][ÝÈ  [È ÌÎNÉ][ÝÉÌÎNÈ    [È ÌÍØÛÛ[X[[YH    [È ÌÎNÉ][ÝÉÌÎNË    ][ÝÉ][ÝËÕ×ÒQJ

I hope this helps. Both of the above should work.

Edit: I didn't think about the source and destination so I added the quotes that should make those work properly. Thanks PSaltyDS.

Regards,

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...