Question Locked

Help with VBscript

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello, Long story short...
I do not know Visual basic. Silly but true. I recently got into voice rec software and want to run a vbscript based on a voice command. I just don't know how to script. I want to simply open a folder, not a specific file, just a folder that contains more folders. For this example, the file is c:\my documents\work pictures\location1. The location1 folder would have other folders in it. Please help. Any assistance would be appreciated and keep in mind, I am vb ignorant.

7 replies

by erinaldo

Dim Pictures

Pictures ="c:\temp"
'Replace c:\temp with your desired directory

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run Pictures

You would just save the above as "whatever".vbs

I'm not sure what kind of voice rec software you are using, but this would only work through the command prompt or perhaps your software allows you to set up some sort of macro based on a simple command. In this example you would either have to set up the voice command to open "whatever".vbs or open a command prompt and execute the script.

by lherndon1973

Yes, this software allows the macro to point to the vb script file. Hmm, just tried it. Came up with a script error.

Error Code 0
Error Description: Object Required:'WScript'
Source Code: Microsoft VBscript runtime error.

What have I done wrong. I pasted your post exactly and changed to path.

by slayer_

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Dim Pictures
Dim WshShell

Pictures ="c:\temp"
'Replace c:\temp with your desired directory

set WshShell = WScript.CreateObject("WScript.Shell")
call WshShell.Run(Pictures)
set WshShell = Nothing

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Try that

by lherndon1973

I pasted the post and only replaced the path, no other changes. This is the error:

Line 7
Column 1
Code 8007007E
Error: Could not create object named "WScript.Shell"
Source: WScript.Createobject

Am I missing something, older version of vbscript or something?

by erinaldo

Hmmm. Both scripts work fine on all my systems. What version of Windows are you running?

This discussion is closed to new replies.