wsh

Hosting WSH (VBScript, JavaScript) in your delphi application?

I'm looking to execute user supplied scripts from my Delphi application. Is it possible to host the Windows Script Host engine in my application and supply it with scripts to execute? Or, is there a better way to approach this problem? P.S I'm not looking for third-party components. ...

JScript Wait function

I have a function written in JScript (Not javascript) I need to suspend until a certain global variable becomes true. The global variable is changed to true when another function is called after an ajax response: function(req, event, data) { globalVariable = true; } When I try to loop until the variable is true: while (globalVaria...

VBScript how to set the connection string

I am not sure whether it has been disscussed before or not but I have the following code (I changed from example for an Access database.) I don't know what to put inside the 'Provider' and the 'Data Source'. I'm using MS SQL Server 2005 and how to find this information in my machine? Please, even I try to follow from here http://www.c...

Set working directory in javascript

Does anyone know how to set the working directory in JavaScript before? Code I use for launching an application is this: // Create an object script oL = new ActiveXObject("WScript.Shell"); oFile = '"C:/Application.exe"'; oL.run(oFile); ...

How can I run a WSH script without seeing the Microsoft header?

When a .vbs script is run from the command line, it will by default show a Microsoft header: Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation. All rights reserved. How can this be disabled? ...

Is there a way to run a command line command from JScript (not javascript) in Windows Scripting Host (WSH) cscript.exe ?

I'm writing a JScript program which is run in cscript.exe. Is it possible to run a commnad line command from within the script. It would really make the job easy, as I can run certain commands instead of writing more code in jscript to do the same thing. For example: In order to wait for a keypress for 10 seconds, I could straight awa...

Testing COM calls in WSH windows script

I have a working C# COM component dll, with a class called MyComponent in the ap namespace, which is added to the GAC and registered successfully. I added a Add() call to it, tested it with a win32 c++ exe and called the Add() call successfully, so its all working. However I want to test the call in WSF (windows script) I put the code b...

VBScript automate right click-[closed]

I want to automate simulation of a right click to open the context menu. Once the menu is open, select the selected action/shortcut available. I know how to open: WshShell.SendKeys("+{F10}"); Or using the AutoIt automation language (BASIC like): ;--on right click event MouseClick("right") $count = 1 Do Send("{D...

Can I initialize objects written in JScript from VBScript?

I am trying to write a WSH logon script. Administrators throughout the company need to be able to customize the execution of the script, and execute additional scripts, for specific locations and users. In order to make their jobs easier, I would like to provide an API that the administrators can access in their scripts. If I write my AP...

Running multiple JScript files in a separate process

I am looking for a way to launch multiple scripts in a separate process from my main script, but in such a way that they can access copies of variables I've declared. Consider the following example: Serializable.js: // Represents serializable data. function Serializable() { /* ... */ } SecondaryScript.wsf // Serializable is not defi...

In JScript, is it possible to implement getters and setters that look like object properties from the outside?

While trying to port and generally playing around with some non-browser code, I came across getters and setters that looked like normal object properties. Something like this: js> var o = { a: 4, get b(){ return this.a + 3; }, set b(val){ this.a = val - 3; } }; js> o.a 4 js> o.b 7 js> o.b=10 10 js> o....

Is there a way to get access to a window handle in windows using WSH, or WMI or similar?

Is there a way to get access to a window handle in windows using WSH, or WMI or similar? I just want to flag a window as always-on-top. Ideally I'd use windows script host for this. Please note, I don't want to install PowerShell on the system in question. We are nervous about any additional software and already have some VBS files inv...

Refresh/Restart Vista's graphical login screen using JScript (WSH)

Background: I have a JScript that runs when the computer starts up (from task scheduler). The script does some magic and determines if a user should be allowed to login at all. It starts by disabling all user accounts and then if a user is to be allowed in it enables the users account by firing the 'net user' command using wshShell.Exec(...

Why is WSH giving me the "expected ;" error?

Im trying to get my feet wet with some WSH. I thought it was going to be easy, but it's really a nightmare... contents of registry.js > Set shell = WScript.CreateObject('WScript.Shell'); strRegValue = 'HKLM/Software/Microsoft/Windows/CurrentVersion/ProductID'; strPID = shell.RegRead(strRegValue); WScript.Echo strPID; This is ...

How can you get STDIN input to a WSH script using cscript.exe?

I'm trying to use WSH in place of DOS/Batch files. Thanks for the input! ...

How do I print the list of registry keys in HKCU\Environment to SDTOUT using JScript (WSH)?

I want to iterate over the environment keys and print a list of these items. ...

Launching WSH/VBScript file from IE8 not working

I have created a custom rightclick menu element in IE8 using the following registry info: [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\WebOn edit] @="c:\\webon_edit\\wo_edit.vbs" The choice "WebOn edit" shows up in IE8's rightclick menu. Before upgrading to Windows 7, this worked fine: When I clicked the menu choice...

Capturing output from WshShell.Exec using Windows Script Host

I wrote the following two functions, and call the second ("callAndWait") from JavaScript running inside Windows Script Host. My overall intent is to call one command line program from another. That is, I'm running the initial scripting using cscript, and then trying to run something else (Ant) from that script. function readAllFromAny...

javascript to stop specific service

Hello, I have the following code in a script. The problem is That I want to get information of scripts that starts in a specific name and are in a specific startmode. var e = new Enumerator(GetObject("winmgmts:").InstancesOf("Win32_Service")) var WSHShell = new ActiveXObject ("WScript.Shell"); var strPrefix = "TTTT"; for(;!e.atEnd(...

setTimeout not working in windows script (jscript)

When I try to run the following code in my program setTimeout("alert('moo')", 1000); I get the following error Error: Object expected Code: 800A138F Source: Microsoft JScript runtime error Why? Am I calling the wrong function? What I want to do is delay the execution of the subsequent function. ...