Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 5th, 2009, 04:16 PM
pmg pmg is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 3 pmg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 21 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old August 5th, 2009, 05:12 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Can you post the path that is being produced and the path you would like to see?
__________________
Don't like me? Click it.

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!

Reply With Quote
  #3  
Old August 6th, 2009, 03:08 AM
pmg pmg is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 3 pmg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 21 sec
Reputation Power: 0
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...

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > WshShell.Run command path problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek