wsh

Is it possible to marry WSH (wscript) with nodejs

一世执手 提交于 2019-12-04 05:10:24
As QA I use WSH scripts to do auto upload, deployment and some time Web testing in IE. WSH(wscript) with JavaScript can open IE window, activate it and access DOM model to do some actions or verify some expected results. It is kind of Selenium 1.0 approach but does not require JAVA and any envrionment configuration so can be executed on any developers/qa windows machine immidiately. Recently I found NodeJS and all its abilities, except manipulating with Windows IE DOM. Cannot find the way on how to run my old WSH scripts to test IE DOM and at the same time use some NodeJS modules to parse XMLs

There's any way to run vbscript directly to wscript or cscript command line

蓝咒 提交于 2019-12-04 04:20:05
I want to run a vbs command from command line as I would in batch calling cmd.exe /c "echo.Hello World! & pause" Obviously this doesn't work wscript /C MsgBox("Hello world") I could print the vbs and then call the temporary file and then delete it cmd.exe /c "echo. [VBSCODE] > temp.vbs & wscript temp.vbs & del temp.vbs" but this is too messy, and I don't want the prompt poping up. this works directly on the command line: mshta vbscript:Execute("MsgBox(""amessage"",64,""atitle"")(window.close)") dbenham VBScript requires a file for its source code. You want to specify stdin as the "file", but

Cycle through webpages and copy data

烂漫一生 提交于 2019-12-04 03:43:52
问题 I created this script for a friend that cycles through a real estate website and snags email address for her (for promotion). The site offers them freely, but it's inconvenient to grab one at a time. The first script dumps each pages data into a txt file called webdump and the second extracts the email addresses from the first txt file. Save each of these in a separate .vbs file. If you want to test the script, you may want to change the following to a lower number (this is how many pages are

WScript.CreateObject crashes Windows Scripting Host when event handler prefix is specified for WinHTTPRequest

时间秒杀一切 提交于 2019-12-04 01:59:59
问题 According to the MSDN documentation WinHTTPRequest has four event handlers which should be accessible by specifying an event handler prefix. Unfortunately, doing so causes Windows Scripting Host to crash. The following code crashes Windows Scripting Host: Set oHTTP = WScript.CreateObject( "WinHttp.WinHttpRequest.5.1", "oHTTP_" ) This code works just fine: Set oHTTP = WScript.CreateObject( "WinHttp.WinHttpRequest.5.1" ) Any thoughts as to why? 回答1: It's not part of the specification in any way

Is it possible to add a directory to DLL search path from a batch file or cmd script?

瘦欲@ 提交于 2019-12-04 01:44:05
MSDN says that the function SetDllDirectory() can be used to insert a directory into the DLL Search Path . Can this function be accessed from a batch file or cmd script, perhaps using via cscript ? The aim is to have our development version of a dll found before a pre-existing older one in %WINDIR% etc. without having to write a program just for that. Thanks in advance for your time and thoughts. martin jakubik You can place the DLL in the same path as the executable, which is searched first before %WINDIR%. There's no way to call SetDllDirectory from a batch file directly. But, you can insert

Creating a scripting language

本秂侑毒 提交于 2019-12-04 01:09:44
问题 Can somebody please guide me in the right direction of creating a scripting language that targets the WSH (Windows Scripting Host)? I have googled for it, but there seem to be far fewer links related to this than when I originally searched for it a few months back. THank you 回答1: You should be able to find all necessary information about creating Windows Script engines on MSDN; other than that there seems to be no resources available (at least I couldn't find any). You can also take a look at

How to open a pdf with WScript.Shell

*爱你&永不变心* 提交于 2019-12-03 21:53:35
I'm creating a HTA application that needs to open PDF document. I cannot assum that the user will have acrobat installed on his PC as in this example The WScript ( documentation ) allow you to run a command line application. But what I would like, is for the WScript to simulate a double click on the file. I would like to be able to do something like var wshShell = new ActiveXObject("WScript.Shell"); wshShell.Exec(pdfFilePath); // That does not work In cmd , you can open a file like this: start c:\path\to\file.pdf Maybe this works wshShell.Exec("start " & pdfFilePath); //do you do string concat

Using Javascript in HTA file to read/write from Windows registry

谁说我不能喝 提交于 2019-12-03 20:28:02
问题 I'm currently attempting to write Javascript in order to read and write from the Windows registry in an HTA file. Here is the current code I am using to write: writeInRegistry = function (sRegEntry, sRegValue) { Regpath = "HKEY_LOCAL_MACHINE\\Software\\CompanyName\\CompanyValues\\" + sRegEntry; try { var oWSS = new ActiveXObject("WScript.Shell"); oWSS.RegWrite(Regpath, sRegValue, "REG_DWORD"); oWSS = null; } catch (e) { alert('Error trying to write "' + sRegValue + '" to registry entry "' +

Classic ASP amazon s3 rest authorisation

烈酒焚心 提交于 2019-12-03 17:41:42
问题 I am confused on what I am doing wrong here... <script language="javascript" runat="server"> function GMTNow(){return new Date().toGMTString()} </script> <% Const AWS_BUCKETNAME = "uk-bucketname" Const AWS_ACCESSKEY = "GOES HERE" Const AWS_SECRETKEY = "SECRET" LocalFile = Server.Mappath("/test.jpg") Dim sRemoteFilePath sRemoteFilePath = "/files/test.jpg" 'Remote Path, note that AWS paths (in fact they aren't real paths) are strictly case sensitive Dim strNow strNow = GMTNow() ' GMT Date

How to show a popup without a browser

試著忘記壹切 提交于 2019-12-03 16:30:14
I need an "alert" type feature to troubleshoot an error. I am not using a browser and using javascript as windows administaration purposes. So is their a way to view a varibales value if I am not using a browser? JScript is a scripting language based on the ECMAScript standard. JScript is implemented as a Windows Script engine. This means that it can be plugged in to any application that supports the Windows Script host, such as Internet Explorer, Active Server Pages, etc. It also means that any application supporting Windows Script can use multiple languages — JScript, VBScript, Perl, and