Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Folder/File....start file.

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
We use a system that produces a set of outputs....2 PDF files and multiple folders with different types of media items in each. One of the PDF files has links to the media files. All the runtime software for each media item in loaded on the computer.

The PDF file links to a vbs file that starts the media that is stored in the appropriate folder Since the folder names are always the same the code should be able to go there no matter where it is. The vbs code gets its own path and then modifies the path to the proper folder and file. It then starts the file (run). This is not working smoothly. The vbs computes the correct path to the file (as shown by MsgBox dialogs)but I keep geting cannot find file notifications.

Is there a way I can use VBS find the correct folder no matter where it is...on computer, server, or external hard drive? If it can, then can I CD (change directory or someting) so when I run the script it starts the file?

Thanks,
 
How about posting some code so we can see what you are actually doing?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
This is in a VBS file named 787_3D.vbs

Dim Fn,Fn1,FSO,s
dim sQuote
dim scriptName : scriptName=WScript.ScriptName
sQuote = chr(34)

Fn=Left(scriptName, Len(scriptName)-4)&".pdf"

Set FSO = CreateObject("Scripting.FileSystemObject")
s=FSO.GetAbsolutePathName(".")
s=s & "\ILCBT\"
s=s & Fn
Fn1 =sQuote & s & sQuote
'Wscript.Echo "File "&Fn1
Set sh= CreateObject("WScript.Shell")
returnVal = sh.run ("""C:\Program Files\Adobe\Reader\AcroRd32.exe"" /n " &Fn1)


Does this help?
 
what happens if you replace your last line of code with just this:
Code:
returnVal = sh.Run(Fn1)

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
markdmac

Actually, I have other scripts that have that exact code...and they are returning the error also. The one you are looking at above is used to start multiple Acrobat sessions so more than one can be open at a time. Other media, not in PDF formts...ie mov, ppt, mpg, etc do not require the extra stuff.

Here is another example: Note the MsgBox's I used to check the computation of the path. the file name is CRGO360.

Dim Fn,Fn1,FSO,s
dim sQuote
dim scriptName : scriptName=WScript.ScriptName
sQuote = chr(34)

Fn=Left(scriptName, Len(scriptName)-4)&".html"
MsgBox Fn
Set FSO = CreateObject("Scripting.FileSystemObject")
s=FSO.GetAbsolutePathName(".")
s=Left (s, Len(s)-6)
MsgBox s
s=s & "\Tours\"
MsgBox s
s=s & Fn
MsgBox s
Fn1 =sQuote & s & sQuote
MsgBox Fn1
'Wscript.Echo "File "&Fn1
Set sh= CreateObject("WScript.Shell")
returnVal = sh.run (Fn1)
 
I'd like to see the output you get from all of your MsgBoxes.

Probably easier for yout o post them if you change them to WSCRIPT.ECHO and run the code from CSCRIPT.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
OK...this is going to be a long one. Here is the new script with new msgbox points.

Dim Fn,Fn1,FSO,s
dim sQuote
dim scriptName : scriptName=WScript.ScriptName
sQuote = chr(34)
Fn=Left(scriptName, Len(scriptName)-4)&".html"
MsgBox Fn
Set FSO = CreateObject("Scripting.FileSystemObject")
s=FSO.GetAbsolutePathName(".")
MsgBox s
s=Left (s, Len(s)-6)
s=s & "\Tours\"
s=s & Fn
MsgBox s
Fn1 =sQuote & s & sQuote
'Wscript.Echo "File "&Fn1
Set sh= CreateObject("WScript.Shell")
returnVal = sh.run (Fn1)
MsgBox Fn1

And here are the message box results:

Message Box 1 CRGO360.html
Message Box 2 C:\Documents and Settings\xjjs8542\Desktop\737 Media Test TMG\TMG Media Demo 2\Video
Message Box 3 C:\Documents and Settings\xjjs8542\Desktop\737 Media Test TMG\TMG Media Demo 2\Tours\CRGO360.html
Message Box 4 "C:\Documents and Settings\xjjs8542\Desktop\737 Media Test TMG\TMG Media Demo 2\Tours\CRGO360.html"

Note: When the vbs script is run from the Video folder it works. When it is linked to from the PDF file it gives the error message shown at the bottom. Remember...the PDF file is just outside the Video and Tours folders.

The PDF file that is linking to the VBS is located in C:\Documents and Settings\xjjs8542\Desktop\737 Media Test TMG\TMG Media Demo\Class-JJS Media Test Book.pdf. The vbs is located in the Video folder as shown in message 2 and it should start the actual CRGO360.html file located in the Tours folder as shown in Message 3 and 4.

Error message script:
script: C:\Documenents and Settings\xjjs8542\Desktop\737 Media Test TMG\Tmg Media Demo 2\Video\CRGO360.vbs
Line: 23
Char: 1
Error: The system cannot find the file specified.
Code: 80070002
Source: (null)
 
I'm trying to create a link from a .pdf file to a system folder where the end user will see the folder contents displayed (as in a folder list from "My Computer").

The idea is for the user to be able to open the files (.msg files) contained in the folder like they would a "My Computer" dialog box.

Links cannot be created in Adobe Pro that merely open file folders, just files, but seems a javascript file might do the trick.

Any ideas?

Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top