wsh

Unicode named Folder shows ? in wscript prompt

喜你入骨 提交于 2021-02-07 19:25:23
问题 I am facing problems with Unicode named folders. When I drag the folder to the script, it doesn't show the path of the folder properly. Simple VBScript (this is just a portion of it): Dim Wshso : Set Wshso = WScript.CreateObject("WScript.Shell") Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject") If WScript.Arguments.Count = 1 Then If FSO.FileExists(Wscript.Arguments.Item(0)) = true and FSO.FolderExists(Wscript.Arguments.Item(0)) = false Then Alert "You dragged a file, not a folder

VBScript set focus on a window in IE

谁说我不能喝 提交于 2021-02-04 18:09:55
问题 I'm updating an old piece of code that uses VBScript to pull up a window in IE. For some reason, it likes to open up behind IE. Google gave me the following couple lines for setting window focus in VBScript: set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate("calculator") However, when I run this in IE, I get the error "Object required: 'WScript'." Is there any way around this in IE, or another way to do this? I'm already opening and manipulating a Word document without

VBScript set focus on a window in IE

末鹿安然 提交于 2021-02-04 18:08:36
问题 I'm updating an old piece of code that uses VBScript to pull up a window in IE. For some reason, it likes to open up behind IE. Google gave me the following couple lines for setting window focus in VBScript: set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate("calculator") However, when I run this in IE, I get the error "Object required: 'WScript'." Is there any way around this in IE, or another way to do this? I'm already opening and manipulating a Word document without

VBScript set focus on a window in IE

自作多情 提交于 2021-02-04 18:07:21
问题 I'm updating an old piece of code that uses VBScript to pull up a window in IE. For some reason, it likes to open up behind IE. Google gave me the following couple lines for setting window focus in VBScript: set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate("calculator") However, when I run this in IE, I get the error "Object required: 'WScript'." Is there any way around this in IE, or another way to do this? I'm already opening and manipulating a Word document without

Current charset of the windows script host

落花浮王杯 提交于 2021-01-28 19:32:02
问题 I write script (js or vbs, not significant) with Windows Script Host that creating .bat file. I want to convert ANSI string to OEM with ADODB.Stream I may get current OEM code page with Split(CreateObject("WScript.Shell").Exec("cmd /c chcp").StdOut.ReadAll, ":")(1) and then convent it to charset with http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx. How I may get the current ANSI(script) charset? 回答1: The Windows codepage can be determined via WMI, by reading

Validate vbScript argument names

 ̄綄美尐妖づ 提交于 2021-01-27 18:43:49
问题 I am calling a vbScript from PowerShell, with arguments that are defined in a text string, and I want to validate that the arguments being used are correct. Say my valid arguments are ARG1 , ARG2 & ARG3 , and someone has a string of "/ARGG1:one /ARG2:two" , I want to validate the named arguments against an array of valid arguments and catch that ARGG1 . Where I am failing is in getting the names of the named arguments. I can reference a particular named argument with WScript.Arguments.Named(

How to link a static library using WAF?

喜夏-厌秋 提交于 2021-01-27 07:01:45
问题 I'm using OpenSSL in my C++ program, and I need to link crypto and ssl with it. If it were for example gcc, I would just pass: -lcrypto -lssl I am adding this dependency in Network-Simulator 3. But I don't know how to do this in WAF. How should I add them as a dependency? 回答1: First you need to check in configure if the library is available, then you can build it. def configure(cnf): # other parameters omitted for brevity cnf.check(lib=["crypto", "ssl"]) def build(bld): # other parameters

What is the difference between creating a COM instance through CreateObject versus ActiveXObject?

女生的网名这么多〃 提交于 2021-01-27 06:31:39
问题 This has been touched on here in the second answer but I don't see how it answers the question (nor does the link provided). What can ActiveXObject do that CreateObject cannot, and vice-versa? 来源: https://stackoverflow.com/questions/7932771/what-is-the-difference-between-creating-a-com-instance-through-createobject-vers

Python, create shortcut with two paths and argument

試著忘記壹切 提交于 2021-01-27 04:47:09
问题 I'm trying to create a shortcut through python that will launch a file in another program with an argument. E.g: "C:\file.exe" "C:\folder\file.ext" argument The code I've tried messing with: from win32com.client import Dispatch import os shell = Dispatch("WScript.Shell") shortcut = shell.CreateShortCut(path) shortcut.Targetpath = r'"C:\file.exe" "C:\folder\file.ext"' shortcut.Arguments = argument shortcut.WorkingDirectory = "C:\" #or "C:\folder\file.ext" in this case? shortcut.save() But i

Single Line Input VBS Autotyper

杀马特。学长 韩版系。学妹 提交于 2021-01-21 09:22:10
问题 I am currently trying to make an autotyper in VBS and I cannot figure out how to easily input what is to be typed. Right now, this is what my code has to look like: Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate "notepad" WScript.sleep 10000 WshShell.SendKeys "H" WScript.Sleep 100 WshShell.SendKeys "e" WScript.Sleep 100 WshShell.SendKeys "l" WScript.Sleep 100 WshShell.SendKeys "l" WScript.Sleep 100 WshShell.SendKeys "o" But I really want my code to have all the text