Question

Locked

Help with VBscript

By lherndon1973 ·
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.

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Script

by erinaldo In reply to Help with VBscript

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.

Collapse -

Hmm, runtime error

by lherndon1973 In reply to Script

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.

Collapse -

bad code , This code is better :)

by Slayer_ In reply to Script

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

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

Collapse -

Hmm, still no good

by lherndon1973 In reply to bad code :(, This code is ...

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?

Collapse -

Version

by erinaldo In reply to Hmm, still no good

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

Collapse -

Re-install

by erinaldo In reply to Hmm, still no good

Try from the command line:

regsvr32 vbscript.dll

Or try re-installing Window Script:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=C717D943-7E4B-4622-86EB-95A22B832CAA

Back to Software Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums