Vbscript To Execute Another Vb Script
I've been trying the following, and get an error "<Line 2: : Object required: 'WScript'>"
What am I doing wrong here?
Set objShell =
I'd appreciate any help! Many thanks! :)
★ BarTender Hero ★
that would be
Set objShell = CreateObject("WScript.Shell")0
Okay, now I have:Dim objShellSet objShell = CreateObject("WScript.Shell")objShell.Run "\\servername\file\anotherfile\testscript.vbs"But I'm getting another error <Line3: : Unknown script error.>0
Try withdim ObjShellSet objShell = CreateObject("WScript.Shell")objShell.Run "cscript \\servername\file\anotherfile\testscript.vbs"instead0
That actually froze BarTender....0
What is your testscript doing exactly? Have you tried with a very simple "MsgBox ()" one?
I just tried to run these lines without having actually a .vbs program to launch, but I received a command prompt dialog saying that the VBS wasn't found, so at least it performed the command...
Also, what is the purpose of running the VBScript within another VBScript? Can you just not paste the VBScript code directly in BarTender or automate BarTender in a different fashion?0
Long story short, if you update a component's VB Scipt, it wont update the OTHER files that component is being used on. I want the component to refer to a master script so all my 1000+ files can update together.
Here is the script: left(Application.SystemUsername, 7) & ".png"
The component is an image looking in a certain folder, and this script tells it the file name to be looking for by formatting a user's username0
I'm guessing my BarTender script may need some kind of subroutine to pull that value back from the testscript0
Have you tried running a different VBScript Testscript, such as just:
MsgBox ("This is a test")
Will this one work when usingdim ObjShellSet objShell = CreateObject("WScript.Shell")objShell.Run "cscript \\servername\file\anotherfile\testscript.vbs"0
Found a solution! Here it is if anybody is curious:
Component script:Set fs = CreateObject("Scripting.FileSystemObject")Set ts = fs.OpenTextFile("\\server\file\anotherfile\testscript.vbs")body = ts.ReadAllts.CloseExecute bodyFile script:value= 'whatever you want to script!This will make a component that refers to a master script!0