vbscript

vbscript : getting application window text

孤街浪徒 提交于 2021-02-07 09:10:32
问题 I am automating the application installation using vbs. I have a code which launches the setup exe file and proceed further with sending the keystroks. But now I need to get the text of the installer window. I can get the title of installer window(using objShell.AppActivate ) but didn't found the way to get the text of that window. Is there any way to capture this in vbs? 回答1: An alternative could be to enumerate process command lines instead of windows: Dim WshShell Set WshShell =

vbscript : getting application window text

独自空忆成欢 提交于 2021-02-07 09:07:58
问题 I am automating the application installation using vbs. I have a code which launches the setup exe file and proceed further with sending the keystroks. But now I need to get the text of the installer window. I can get the title of installer window(using objShell.AppActivate ) but didn't found the way to get the text of that window. Is there any way to capture this in vbs? 回答1: An alternative could be to enumerate process command lines instead of windows: Dim WshShell Set WshShell =

VBScript determine which function is running

≡放荡痞女 提交于 2021-02-07 04:32:25
问题 Is it possible in VBScript to determine the name of the function currently executing? In .NET, you could do: MethodBase method = MethodBase.GetCurrentMethod(); Console.WriteLine(method.Name); 回答1: In the past, I build a callstack viewer to see the performance of each function that is called. This needs one extra line of VBS code per function/sub and some overhead during runtime of course because of the extra code. bottom - up: Function DoSomething(a, b, c) dim registerFunctionObj : Set

Create custom Windows 10 notification boxes

只愿长相守 提交于 2021-02-07 04:31:20
问题 in Windows 10 there are those gray notification boxes in the lower right corner. They come when you plug in a USB, when Updates were installed or when a virus was found by windows defender. My question: How can i create these things? (with a custom message), if possible in vbs or batch as than they would be the easy to call from all programming languages. I know that this is possible as these boxes will also popup when someone pokes you in teamspeak. Thank you for any answers! 回答1: Those are

VBScript, purpose of colon?

隐身守侯 提交于 2021-02-05 20:53:56
问题 What is the purpose of the colon? e. g.: Dim objConn : Set objConn = OpenConnection()` Is the colon used to combine the two statements into one line? I just want to be sure. P.S.: I tried searching the answer to this question on Google with no luck. 回答1: Yes, the code would work exactly the same on two lines; the colon's just a statement separator. 回答2: You can put two (or more) lines of code in one line. It's most often used, as in your example, to declare and set a variable on one line.

MsgBox argument 'vbMsgBoxSetForeground' has no function

寵の児 提交于 2021-02-05 12:28:25
问题 According to the documentation about the MsgBox argument vbMsgBoxSetForeground : "The message box window becomes the foreground window." In Windows 10 I've the problem (in Windows 7 & XP I didn't have this problem) that some message boxes (VBScript called from a minimized batch file) are not visible because they are covered by other open windows. That's why I wanted to add the argument vbMsgBoxSetForeground to my message boxes: Call MsgBox("Test Message", vbMsgBoxSetForeground) . But

MsgBox argument 'vbMsgBoxSetForeground' has no function

隐身守侯 提交于 2021-02-05 12:26:32
问题 According to the documentation about the MsgBox argument vbMsgBoxSetForeground : "The message box window becomes the foreground window." In Windows 10 I've the problem (in Windows 7 & XP I didn't have this problem) that some message boxes (VBScript called from a minimized batch file) are not visible because they are covered by other open windows. That's why I wanted to add the argument vbMsgBoxSetForeground to my message boxes: Call MsgBox("Test Message", vbMsgBoxSetForeground) . But

how can we simulate keyboard keys using vbs?

南笙酒味 提交于 2021-02-05 11:17:06
问题 I'm aware of the probably most common form: set wShell = createObject("wscript.shell") wShell.sendKeys ":){ENTER}" this uncommon and limited way: Set ShellApp = CreateObject("Shell.Application") ShellApp.WindowSwitcher we can hackishly use sleep if we want a sequence of keys which depends on other events: WScript.sleep 987 wShell.sendKeys "foo{!}~" WScript.sleep 789 wShell.sendKeys "^a^c" and we can't really keep a key pressed but we can repeat it many times: wShell.sendKeys "{LEFT 42}" now..

VBscript to run a bat file with elevated privileges

我的梦境 提交于 2021-02-05 09:45:53
问题 Here is my bat file REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f REG DELETE "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIdValidation /f C:\Windows\System32\wuauclt.exe /resetauthorization /detectnow C:\Windows\System32\wuauclt.exe /reportnow The bat file doesn't work unless it's run inside an "Administrator Command Prompt" My question is how can I use a VBScript wrapper to run the bat file as an Admin? I was trying

DeleteFile with Permission Denied

守給你的承諾、 提交于 2021-02-05 07:56:33
问题 I'm running into and issue that has many entries on Stack Overflow, but none of them solved my problem. I have this piece of code, which tries to delete every .txt in a folder, but I keep getting a permission denied error on the "DeleteFile" command: directory = "C:\TEST\FOLDER" Set fso = CreateObject("Scripting.FileSystemObject") Function DeleteTXTs For Each f In fso.GetFolder(directory).Files If LCase(fso.GetExtensionName(f)) = "txt" Then fso.DeleteFile("C:\TEST\FOLDER\*.txt")