|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi folks,
I'm trying to run a local program, HTMLDOC, to convert a HTML file I've just generated from a form into PDF and then display the PDF to the user. I also had problems with quotations that I believe I've now resolved, but the problem I'm now having is that the program doesn't appear to execute and while I'm capturing and displaying the error code to myself it's most unhelpful - it just says "2" (sans quotations). The code snippit is this: name_fileHTML= "invoiceconvert.html" dir = Server.MapPath(name_fileHTML) fic_html = dir fic_pdf = Server.MapPath("invoice.pdf") wpath= chr(34) & "C:\Program Files\HTMLDOC\htmldoc.exe" & chr(34) & " -t pdf --quiet --webpage -f " & chr(34) & fic_pdf & chr(34) & " " & chr(34) & fic_html & chr(34) returncode = wshell.run(wpath,SW_SHOWNORMAL,true) From the debugging I've managed to do I've ascertained that wpath does say what I want it to say, and the same string from a local command prompt executes and works just fine - so I'm baffled! Being that I can't find anywhere on the internet a guide to what the returned errors on the wshshell.run object actually mean - can anyone at all shed any light? Pretty please! haha Last edited by Nilpo : August 5th, 2009 at 05:12 PM. |
|
#2
|
||||
|
||||
|
Can you post the path that is being produced and the path you would like to see?
__________________
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|
#3
|
|||
|
|||
|
sure, the path should be:
"C:\Program Files\HTMLDOC\htmldoc.exe" -t pdf --quiet --webpage -f "E:\Inetpub\...\invoice.pdf" "E:\Inetpub\...\invoiceconvert.html" (I've obscured some of the file path deliberately, but it is correct) And that is pretty much what the debug info tells me I'm passing. The only thing I can think of is that when I'm sending myself path in an email just before it executes, there seems to be a new line between the path to the PDF and the path to the HTML file - such as: "C:\Program Files\HTMLDOC\htmldoc.exe" -t pdf --quiet --webpage -f "E:\Inetpub\...\invoice.pdf" "E:\Inetpub\...\invoiceconvert.html" Being that I'm not deliberately putting a return in I can't say why that is but I guess that could be a potential issue... Quick update! I tried replacing the space I'd put in wpath to seperate the path to the PDF file and HTML file by doing: & " " & With: & chr(32) & And got no different results, but when I remove that space altogether it fails with error code 1 rather than 2 - I'd fully expect it to fail of course, but figured the change in error code may shed some light if anyone knows what they actually mean lol. It looks to me like that space may be putting a new line in the string, but I can't figure out why... |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > WshShell.Run command path problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|