the custom files folder

I need help using wshShell.Run or WshShell. Exec to load a pdf or other document from the custom files folder. This is for a standalone exe (a gadget).

Basically, I've tried:

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("%exedir%\Readware Technologyo.pdf")
Set WshShell = Nothing

and several variations on oExec, e.g.:
WshShell.Exec("%exedir%\Techo.pdf")
WshShell.Exec("%objectdir%\Techo.pdf")
WshShell.Exec("%objectdir%\\Techo.pdf")

I would like to include the file as a custom file because I can distribute it that way as an executable without having to install anything.

I also tried the Run command of Wscript. I know its my file construct but I don't know how to fix it. It seems one of these should work. Only with a double slash do I get an error "file not found".

-Ken
4,245 views 4 replies
Reply #1 Top
According to the Windows Script documentation, the Exec command only works for executable files (as near as I can tell). The Run command, on the other hand is supposed to work on registered file types also. The only caveat with using Run is that it doesn't deal with spaces in the path unless the whole thing is bracketed in quotes. You need to do something like:

Dim strCommands
strCommands="%exedir%\Techno.pdf"
WshShell.Run(chr(34) & strCommands & chr(34))

Hope that works for you ...
Reply #2 Top
It did not. Now I am back to my original error:

(null)
Line: 63
Code:
(not available)

The code is:

60: Dim WshShell, strCommand
61: strCommand = Chr(34)& "%objectdir%\Techo.pdf" & Chr(34)
62: Set WshShell = CreateObject("WScript.Shell")
63: WshShell.Run(strCommand)
64: Set WshShell = Nothing

I tried it the way you recommended too. No difference in the result.

I get this error always (using the WshShell.Run method) w/-or-w/o using chr(34) to surround the item. I do not know if the (null) refers to the Run command being empty or to the %objectdir% or %exedir% being empty.
Reply #3 Top
yeah, btw while the file name is mangled in these examples I was careful to check that it is correct in the actual run. -Ken
Reply #4 Top
I found out the path variables like %objdir% work fine if you create an object and use the paht variable in the name of the file in the object dialog.

You (I) cannot, however, use %objdir% in the ways attempted above. The alternative is to use the built in Object.diretory loaded to a variable e.g., wd = Object.directory and pass the path that way.

Obviously the error noted above at line 63 indicated the path variable was not available (null).

So I am posting this, just to clear the up trouble as no one could tell me what to do about it, even in the support chat room. I should think someone at Stardock would have known about this and could have responded.


Posted via WinCustomize Browser/Stardock Central