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
This is because of how the Base64 encoding deals with long strings. From RFC 2045 – 6.8 Base64 Content-Transfer-Encoding The encoded output stream must be represented in lines of no more than 76 characters each. All line breaks or other characters not found in Table 1 must be ignored by decoding software. In base64 data, … Read more
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
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
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
Do not try to parse the file yourself, you’ll just give yourself a headache. There’s quite a bit more to it than splitting on newline and commas. You can use OLEDB to open up the file in a recordset and read it just as you would a db table. Something like this: Dim strConn, conn, … Read more
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
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
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