Is the Sleep operation no longer used in VBscript?

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

Call a Unix Script from Excel Vba

One option would be to open the plink session in a WScript.Shell instead of executing it with a script file using VBA’s Shell. The plink program will run in interactive mode from the command line, and the WshExec object gives you direct access to the standard input and standard output streams of the process that … Read more

reusing Internet Explorer COM Automation Object

Try This: Set IEObject = GetObject( ,”InternetExplorer.Application” ) *Notice the comma before “InternetExplorer.Application” EDIT: Try this: Dim IE As SHDocVw.InternetExplorer Set IE = GetObject(,”InternetExplorer.Application”) You can also try this: Dim ShellApp Set ShellApp = CreateObject(“Shell.Application”) Dim ShellWindows Set ShellWindows = ShellApp.Windows() Dim i For i = 0 To ShellWindows.Count – 1 If InStr(ShellWindows.Item(i).FullName, “iexplore.exe”) <> … Read more

File updload in post form in VBS

You are trying to upload binary file content as base64 encoded text, so it’s necessary to specify the appropriate MIME header, here is the fixed snippet of your code: request = request & sBoundary & vbCrLf request = request & “Content-Disposition: form-data; name=file; filename=” & sFile & vbCrLf request = request & “Content-Type: application/x-object” & … Read more

How to control Windows system volume using JScript or VBScript?

The best way I can see for manipulating the system volume level on Windows without the need for installing additional software is to use VBScript in one of the following ways: Toggle muted: (already mentioned in a previous answer) Set WshShell = CreateObject(“WScript.Shell”) WshShell.SendKeys(chr(&hAD)) Increase volume level: Set WshShell = CreateObject(“WScript.Shell”) WshShell.SendKeys(chr(&hAF)) Decrease volume level: … Read more

How to encrypt in VBScript using AES?

One way is to declare encryption classes within vbscript, without needing external added COM objects or wrapper. The following example takes a string, encrypts and decrypts using Rijndael managed class: ‘—————————————————– Dim obj,arr,i,r,str,enc,asc dim bytes,bytesd,s,sc,sd set obj=WScript.CreateObject(“System.Security.Cryptography.RijndaelManaged”) Set asc = CreateObject(“System.Text.UTF8Encoding”) s=”This is a private message” bytes=asc.GetBytes_4(s) obj.GenerateKey() obj.GenerateIV() set enc=obj.CreateEncryptor() set dec=obj.CreateDecryptor() bytec=enc.TransformFinalBlock((bytes),0,lenb(bytes)) sc=asc.GetString((bytec)) … Read more