Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a WScript.shell activeX to execute a command line
    text
    copied!<p>I am working on calling a .exe file with a WScript.shell activeX. The file is wkhtmltopdf.exe and it is used to convert a HTML page to a .pdf. Everything is working well when I am just calling C:\wkhtmltopdf.exe in the code. It runs and then closes correctly. But my issue is you need to run it from cmd with the program name then the HTML file name you are reading followed by the .pdf name you want it to be created as. </p> <p>For example: </p> <pre><code>c:\wkhtmltopdf.exe c:\PDFTestPage.html c:\TEST.pdf </code></pre> <p>This will call wkhtmltopdf.exe, read c:\PDFTestPage.html, then create c:\TEST.pdf. Works fine when I type it into cmd. </p> <p>Does anyone know an activeX that will not just run and .exe but actually execute a command line?</p> <p>Here is my code that I am currently using. </p> <pre><code>function callShellApplication(){ var objShell = new ActiveXObject("WScript.shell"); objShell.run('"c:\wkhtmltopdf.exe"'); } </code></pre> <p>Would really like it to be the following.</p> <pre><code>function callShellApplication(){ var objShell = new ActiveXObject("WScript.shell"); objShell.run('"c:\wkhtmltopdf.exe c:\PDFTestPage.html c:\TEST.pdf"'); } </code></pre> <p>Also side note. For some reason I cant launch the .exe from an absolute path. I have to move to the directory and then just type in wkhtmltopdf.exe. The fill path is:</p> <pre><code>C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf.exe </code></pre> <p>I really only work with UNIX so I'm not sure about spaces in the path. I can do a chdir with the spaces but I cant use the fill path when executing it. Any information would be helpful. Thank you in advance. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload