the custom files folder

Thursday, June 23, 2005 by mitioke | Discussion: DesktopX Development

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
MountainDragon
Reply #1 Thursday, June 23, 2005 2:59 PM
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 ...
mitioke
Reply #2 Thursday, June 23, 2005 4:15 PM
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.
mitioke
Reply #3 Thursday, June 23, 2005 4:19 PM
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
mitioke
Reply #4 Saturday, July 2, 2005 3:24 PM
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

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01