Run a vbscript from another vbscript
See if the following works Dim objShell Set objShell = Wscript.CreateObject(“WScript.Shell”) objShell.Run “TestScript.vbs” ‘ Using Set is mandatory Set objShell = Nothing
See if the following works Dim objShell Set objShell = Wscript.CreateObject(“WScript.Shell”) objShell.Run “TestScript.vbs” ‘ Using Set is mandatory Set objShell = Nothing
Daniel’s answer is absolutely correct about context being the key here. Although you don’t have the WScript method available, you do have the full browser DOM, including the window.setTimeout method. With VBScript, the semantics of passing code to setTimeout are a little bit different than JavaScript, but it’s still possible: Sub button1_onclick() window.setTimeout GetRef(“Delayed”), 1000 … Read more
You get that error when you call ReadAll on an empty file. Check the AtEndOfStream property and read the content only if it’s false: If Not file.AtEndOfStream Then fileText = fileText & file.ReadAll
This error is because you cannot dim variables as something in particular in VBS. Said more explicitly the “Dim” statement is used without defining the variable type in VBScript because all variables in VBScript are automatically of type Variant. If you attempt to Dim a variable as anything, it will throw an error. Instead, you … Read more
The secret to using the common dialog from VBScript (or VBA or JScript, for that matter) is that you have to have its license installed on your machine. Certain development tools, such as Visual Basic 6, will install the license, but it’s also installed by the free Microsoft HTML Help Editor (this is a pretty … Read more
Set objFSO=CreateObject(“Scripting.FileSystemObject”) ‘ How to write file outFile=”c:\test\autorun.inf” Set objFile = objFSO.CreateTextFile(outFile,True) objFile.Write “test string” & vbCrLf objFile.Close ‘How to read a file strFile = “c:\test\file” Set objFile = objFS.OpenTextFile(strFile) Do Until objFile.AtEndOfStream strLine= objFile.ReadLine Wscript.Echo strLine Loop objFile.Close ‘to get file path without drive letter, assuming drive letters are c:, d:, etc strFile=”c:\test\file” s … Read more
LabelName doesn’t need to be a shell object, as it’s just a string. Then concatenate the string onto the run command and you are done. Set oShell = WScript.CreateObject(“WScript.Shell”) Dim LabelName LabelName = InputBox(“Please Enter Label to check-out:”, _ “Create File”) oShell.run “cmd /K “”c:\Program Files (x86)\Borland\StarTeam Cross-Platform Client 2008 R2\stcmd.exe”” co -p bla:[email protected]:7777/bla/ -is … Read more
A workaround would be to use PopUp Set objShell = WScript.CreateObject(“WScript.Shell”) For i = 1 To 3 objShell.Popup i, 1, “AutoClose MsgBox Simulation”, vbInformation+vbOKOnly Next This will “autoclose” the MsgBox lookalike after 1 second
Gmail users can access their account on the official website or by using first-party or third-party apps and services instead. A first party app is for instance Google’s official Gmail app for Android, while Thunderbird and the mail client app of Windows 8 are third-party apps. Google announced back in April 2014 that it would … Read more
You need to quote the file specification: Run(“%comspec% /K “”C:\Program Files\ping.bat”””)