matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [Request] Need pro help on this one.
code: /*
This script will simulate pressing ALT+TAB when a
specific user signs in
(C) Matty 2007
*/
var kbdevent_keyup = 0x2;
var vk_alt = 0x12;
var vk_tab = 0x9;
var oWMI = GetObject('winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2');
function OnEvent_ContactSignin(sEmail) {
if (sEmail === '123@hotmail.com') {
var oProcesses = oWMI.ExecQuery('Select * From Win32_Process');
for (var oProcess = new Enumerator(oProcesses); !oProcess.atEnd(); oProcess.moveNext()) {
if (oProcess.item().Name.toLowerCase() === 'legacygamers.exe') {
Interop.Call('user32', 'keybd_event', vk_alt, 0, 0, 0);
Interop.Call('user32', 'keybd_event', vk_tab, 1, 0, 0);
Interop.Call('user32', 'keybd_event', vk_alt, 0, kbdevent_keyup, 0);
}
}
}
}
This post was edited on 12-30-2007 at 03:48 PM by matty.
|
|