?
Solved

VB Script to display a .pdf file on AS400

Posted on 2009-04-15
14
Medium Priority
?
760 Views
Last Modified: 2013-12-06
I have created a vb script that can be run from the AS400 to display a pdf file based on some screen information.  The last line is causing me a problem on a few pc's.  It's strange because it runs on 2 pc's with no issues, but on the other pc's it gives me an error on the following line:

ProcessID = autSystem.shell("acrobat.exe","S:\MSDS\"  & Trim(RetVal) & ".pdf")

This happens to be the last line if that matters.
0
Comment
Question by:dkempa
  • 6
  • 4
  • 4
14 Comments
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 24151675
Hi dkempa,

Did you check the language (charactercode) code of the PC's that are working agianst the non working PC's?

Regards,
Murph
0
 

Author Comment

by:dkempa
ID: 24151759
How would I go about checking that?  I'm sorry but I work mainly on the AS400 side.
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 24152491
Configuration Country/language
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 36

Accepted Solution

by:
Gary Patterson earned 1000 total points
ID: 24153180
It would be a lot easier to help if we knew what the error message said.

That said, there are a few things to check:

1) Is acrobat.exe in a folder that is in the PATH environment variable?  Open a command prompt on the problem PCs, and type "SET" or "echo %path%" to see the contents of the PATH environment variable.  Or just try "acrobat.exe" from the command line.  If Acrobat doesn't start, the error message should give a hint as to the problem.
2) Is the "S:" drive mapped properly on the problem systems at the time the scrip is run?  Does the logged in user have rights to the share?  Try opening the file manually on that PC by navigating to the share and double-clicking the PDF.
3) Is acrobat.exe even installed on those machines (that is the exe for the full-blown Acrobat probram, not the free Acrobat Reader.)?

Again, the error message will probably help narrow down the problem.  Open up a command prompt window and run the VBS (CSCRIPT xxx.vbs) and cut and paste the error message and the VBS file here.

- Gary Patterson



0
 

Author Comment

by:dkempa
ID: 24154125
The error message says there is an error in the script at line 17 would you like to edit it.  That's all it gives.

Acrobat is loaded and the S: is mapped and I can go to the location and open the pdf manually with no issue?

I will try running in the am to see if I can get more of an error message.
Thanks so much for trying to help.
0
 
LVL 36

Expert Comment

by:Gary Patterson
ID: 24154183
Drop a bit of error handling into your script and echo the Err.Number, .Source, and .Description:  

http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/shop1205.mspx

- Gary Patterson


0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 24154789
Can you tell me (us) what the contents is of variable Test if you include this command:

Test = "acrobat.exe","S:\MSDS\"  & Trim(RetVal) & ".pdf"

I like to know it from both PC's (the working and the non working)

Murph
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 24154797
Hi dkempa,

Sorry that will not work, Ik mean:

Test = "S:\MSDS\"  & Trim(RetVal) & ".pdf"
0
 

Author Comment

by:dkempa
ID: 24158153
When I view the contents I can now tell what the problem is, but I don't know how to fix it.

On the working pc
I get S:\MSDS\0100-42-5.pdf

On the non working pc
I get S\MSDS\0100-42-5.pdf  (the : doesn't come through??)

Any ideas?
0
 

Author Comment

by:dkempa
ID: 24158215
OK.  I lied, they both look the exact same as long as I type it correctly!!

This is the last line of the VBScript that always gets the error, is there some type of end of file it may be looking for?
0
 
LVL 36

Expert Comment

by:Gary Patterson
ID: 24159412
Add this to your script.  Run the script.  Post the results here if the detailed error doesn't solve it for you.

- Gary Patterson

On Error Resume Next    ' Add this at the top of your script
...
...
' Add this after the problem line
If Err.Number <> 0 Then
    WScript.Echo "Error: " & Err.Number
    WScript.Echo "Error (Hex): " & Hex(Err.Number)
    WScript.Echo "Source: " &  Err.Source
    WScript.Echo "Description: " &  Err.Description
    Err.Clear
End If

Open in new window

0
 

Author Comment

by:dkempa
ID: 24160383
The message now comes up and says:

The specified file was not found.

However, the path is correct and the files is there.   Since it was a mapped drive I thought that might be a problem, so I moved the file to C and tried and it still tells me the file is not found.

Any ideas?
0
 

Author Comment

by:dkempa
ID: 24160945
OK, I know what the difference is now.

I have Adobe Acrobat the full blown version, however these others only have the reader loaded.
I found that executable and replaced acrobat.exe with acroRd32.exe and now I don't get an error but Adobe reader doesn't come up.

Any ideas?

0
 
LVL 36

Expert Comment

by:Gary Patterson
ID: 24161162
Are you sure the "missing file" error is referring to the PDF and not to acrobat.exe?

Go to Start -> Run -> and type in Acrobat.exe.  If Acrobat doesn't start, then that is the problem.  You either need to modify the PATH environment variable, or add (or fix) the appropriate App Path entry in the registry.

An App Path entry usually gets created for Acrobat when it is installed.  This may be a sign that you have a corrupt or partially corrupt installation of Acrobat if this entry is missing.  You can always reinstall or repair your Acrobat install.

App Path is discussed down in the middle of this article:

http://commandwindows.com/runline.htm

- Gary Patterson
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question