Spiff59 Posted January 12, 2009 Posted January 12, 2009 (edited) I was going to suggest some indexing earlier, and then someone else did. Why not take the subscripting a little farther? expandcollapse popup;----- Choose HotKeys here ----- ; Change the hotkeys to whatever you want them to be (see helpfile) Global $aHotKeys[9][3] = [ _ ["{F1}", "y@ " , ", Please watch your language on our servers. Thanks."], _;AbuseLang ["{F2}", "y@ " , ", Please keep inappropiate content off of our servers. Thank you."], _;FoulLang ["{F3}", "y@ " , ", Please do not spray your spray again in our servers. Thank you."], _;BadSpray ["{F4}", "y@ " , ", Please change your name, as <these words> are not allowed on our servers. Thank you."], _;BadName ["{F5}", "sm_kick " , " Repeated use of foul/abusive language"], _;AbuseKick ["{F6}", "sm_kick " , " Repeated use of inappropiate language"], _;FoulKick ["{F7}", "sm_kick " , " Inappropiate spray"], _;SprayKick ["{F8}", "sm_kick " , " Inappropiate name"]];NameKick Global $aSize = (UBound($aHotKeys) - 1) ;----- Assign HotKeys ----- For $i = 1 to $aSize HotKeySet($aHotKeys[$i][0],"HotKeyPressed") Next ;===== LOOP ===== While 1 Sleep(100) WEnd ;----- Commands to send after HotKey pressed ----- Func HotKeyPressed() If winactive("YoureApp", "") Then For $i = 1 to $aSize If @HotKeyPressed = $aHotKeys[$i][0] Then Send($aHotKeys[$i][1] & ClipGet() & $aHotKeys[$i][2]) ExitLoop EndIf Next Else HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) HotKeySet(@HotKeyPressed,"HotKeyPressed") EndIf EndFunc Edited January 12, 2009 by Spiff59
fctd Posted January 12, 2009 Posted January 12, 2009 It won't work ! [list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]
andybiochem Posted January 12, 2009 Posted January 12, 2009 But the game I am using doesn't recognize hotkeys set by other applications, and it only seems to work with IsPressed(). Ok, here it is hammering _Ispressed 80 times per second. expandcollapse popup#include <Misc.au3> ;----- Choose HotKeys here ----- ; Change the hotkeys to whatever you wantthem to be (see helpfile) Global $aHotKeys[9] $aHotKeys[1] = 70;AbuseLang F1 $aHotKeys[2] = 71;FoulLang F2 $aHotKeys[3] = 72;BadSpray F3 $aHotKeys[4] = 73;BadName F4 $aHotKeys[5] = 74;AbuseKick F5 $aHotKeys[6] = 75;FoulKick F6 $aHotKeys[7] = 76;SpayKick F7 $aHotKeys[8] = 77;NameKick F8 ;----- open dll ----- $dll = DllOpen("user32.dll") ;===== LOOP ===== While 1 Sleep(100) ;----- loop through keys ----- For $i = 1 to (UBound($aHotKeys) - 1) If _IsPressed($aHotKeys[$i],$dll) Then HotKeyPressed($aHotKeys[$i]) Next WEnd ;----- Commands to send after HotKey pressed ----- Func HotKeyPressed($Key) Local $sPlayerName = ClipGet() Switch $key Case $aHotKeys[1];AbuseLang Send('y@ ' & $sPlayerName & ', Please watch your language on our servers. Thanks.', 1) Case $aHotKeys[2];FoulLang Send('y@ ' & $sPlayerName & ', Please keep inappropiate content off of our servers. Thank you.', 1) Case $aHotKeys[3];BadSpray Send('y@ ' & $sPlayerName & ', Please do not spray your spray again in our servers. Thank you.', 1) Case $aHotKeys[4];BadName Send('y@ ' & $sPlayerName & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1) Case $aHotKeys[5];AbuseKick Send('sm_kick ' & $sPlayerName & ' "Repeated use of foul/abusive language"', 1) Case $aHotKeys[6];FoulKick Send('sm_kick ' & $sPlayerName & ' "Repeated use of inappropiate language"', 1) Case $aHotKeys[7];SpayKick Send('sm_kick ' & $sPlayerName & ' "Inappropiate spray"', 1) Case $aHotKeys[8];NameKick Send('sm_kick ' & $sPlayerName & ' "Inappropiate name"', 1) EndSwitch EndFunc Note, there is another way to do this without using IsPressed, but it the code could very easily be used to key-log, so I'm not going to post it. See the helpfile if you find your cpu is melting from the above script. - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
DangerousDan Posted January 12, 2009 Posted January 12, 2009 Cannot use the hotkeyset so that script is ruled out. But the 3rd example has no pauses, so the CPU is going to get hammered to detect a keypress. 10 seconds is a long time for a pause, but I figure anywhere from 20 to 200 milliseconds is a okay amount.the 10 second pause was just to illustrate the point; I had not considered CPU usage, thanks for making me open my mind what is another method, without posting the offending code, to capture a keystroke? I was under the impression (albeit without the proper knowledge) that hotkeyset and ispressed were the only methods to capture the users input... I'm not making a keylogger, but need to know when a user sends specific keys to the AS400 emulator so I know to poll the AS400 emulator for screen changes. I tried hotkeyset with passthroughs to the program, but it was not reliable as I am (or rather I was) using some of the keys depending upon what is displayed and what function keys are available by the parent app at that time. I ended up using hotkeyset bound to keys the emulator does not use and removing the automatic user prompts I had hoped to include in my app. I won't be able to (entirely too many changes now) use it in my app, but for future reference it would be nice to know.sorry to hijiack, but only a simple response is expected
AgentSmith15 Posted January 13, 2009 Author Posted January 13, 2009 (edited) Note, there is another way to do this without using IsPressed, but it the code could very easily be used to key-log, so I'm not going to post it. See the helpfile if you find your cpu is melting from the above script. *COUGH* SetWindowsHookEx */COUGH*If you would have never said anything about keyloggers it would have never crossed my mind. So doesn't that defeat the purpose?Anyways I want the subject changed no more talk about malicious intentions. Edited January 13, 2009 by AgentSmith15 [center][/center]
AgentSmith15 Posted January 13, 2009 Author Posted January 13, 2009 According to this thread of the fastest ways to write things For/Next are faster than While?http://www.autoitscript.com/forum/index.php?showtopic=51604So to make a infinite loop with a For Loop would I do this?For $i = 1 to 2 Step 0I have a feeling this is breaking rules, but I gotta go to bed. I will test in the morning... [center][/center]
andybiochem Posted January 13, 2009 Posted January 13, 2009 According to this thread of the fastest ways to write things For/Next are faster than While? http://www.autoitscript.com/forum/index.php?showtopic=51604 So to make a infinite loop with a For Loop would I do this? For $i = 1 to 2 Step 0 Interesting! A quick test... $TestLength = 10000000 $i = 0 $timer = TimerInit() While 1 $i += 1 If $i = $TestLength Then ConsoleWrite(TimerDiff($timer) & @CRLF) ExitLoop EndIf WEnd $i = 0 $timer = TimerInit() For $t = 1 to 2 Step 0 $i += 1 If $i = $TestLength Then ConsoleWrite(TimerDiff($timer) & @CRLF) ExitLoop EndIf Next For 10 million loops, WHILE LOOP = 36.2 seconds FOR LOOP = 32.1 seconds Not much in it, but if you're going for pure speed, why not?!? Note - this won't speed up the _IsPressed functions! - Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
AgentSmith15 Posted January 14, 2009 Author Posted January 14, 2009 It's not about pure speed, but if you can do a loop faster than you don't have to hammer IsPressed as much. So I can afford to bump up the sleep by 5 milliseconds. [center][/center]
AgentSmith15 Posted January 16, 2009 Author Posted January 16, 2009 (edited) So I hacked up a script, but I am having some problems with a few keys. I'm trying to figure out why the Scroll Key and the Pause Key are not getting recognized by my script. I must be getting the key code wrong :/ Also I am I unregistering User32 properly? Does anyone know a good way to organize this script into a neater format? expandcollapse popupGlobal Const $WH_KEYBOARD_LL = 13 Global Const $KEY = 257 Global Const $SCROLL = 91 Global Const $PAUSE = 19 Global Const $INSERT = 45 Global Const $DELETE = 46 Global Const $HOME = 36 Global Const $PAGEUP = 33 Global Const $PAGEDOWN = 34 Global Const $END = 35 ClipPut("") Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Global $hmod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($pStub_KeyProc), _ "hwnd", $hmod[0], _ "dword", 0) $hHook = $hHook[0] While 1 Sleep(10) WEnd Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $aRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _ "lparam", $lParam) Return $aRet[0] EndIf Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Local $iFlag = DllStructGetData($KBDLLHOOKSTRUCT, "flags") While $iFlag = 1 Switch $vkCode Case $SCROLL Call("AbuseLang") Case $PAUSE Call("FoulLang") Case $INSERT Call("BadSpray") Case $DELETE Call("BadName") Case $HOME Call("AbuseKick") Case $PAGEUP Call("FoulKick") Case $PAGEDOWN Call("SprayKick") Case $END Call("NameKick") EndSwitch WEnd EndFunc ;==>_KeyProc ;Warnings Below Func AbuseLang() $PlayerName = ClipGet() Send('y@ ' & $PlayerName & ', Please watch your language on our servers. Thanks.', 1) EndFunc ;==>AbuseLang Func FoulLang() $PlayerName = ClipGet() Send('y@ ' & $PlayerName & ', Please keep inappropiate content off of our servers. Thank you.', 1) EndFunc ;==>FoulLang Func BadSpray() $PlayerName = ClipGet() Send('y@@ ' & $PlayerName & ', Please do not spray your spray again in our servers. Thank you.', 1) EndFunc ;==>BadSpray Func BadName() $PlayerName = ClipGet() Send('y@@ ' & $PlayerName & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1) EndFunc ;==>BadName ;Kicks Below Func AbuseKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Repeated use of foul/abusive language"', 1) EndFunc ;==>AbuseKick Func FoulKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Repeated use of inappropiate language"', 1) EndFunc ;==>FoulKick Func SprayKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Inappropiate spray"', 1) EndFunc ;==>SprayKick Func NameKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Inappropiate name"', 1) EndFunc ;==>NameKick Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook) DllCallbackFree($pStub_KeyProc) EndFunc ;==>OnAutoItExit Edited January 16, 2009 by AgentSmith15 [center][/center]
AgentSmith15 Posted January 16, 2009 Author Posted January 16, 2009 (edited) The script seems to loop when it detects a hotkey and will keep calling the said function without stopping. Wow, 4 o'clock in the morning. Edited January 16, 2009 by AgentSmith15 [center][/center]
BrettF Posted January 16, 2009 Posted January 16, 2009 I searched for the function which pointed me to this:http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspxIt appears you have to return 0. It works without high CPU, so I'm happy And as I said before, no need to use call.Check this out:expandcollapse popupGlobal Const $WH_KEYBOARD_LL = 13 Global Const $KEY = 257 Global Const $SCROLL = 91 Global Const $PAUSE = 19 Global Const $INSERT = 45 Global Const $DELETE = 46 Global Const $HOME = 36 Global Const $PAGEUP = 33 Global Const $PAGEDOWN = 34 Global Const $END = 35 ClipPut("") Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Global $hmod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($pStub_KeyProc), _ "hwnd", $hmod[0], _ "dword", 0) $hHook = $hHook[0] While 1 Sleep(20) WEnd Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $aRet = DllCall ("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _ "lparam", $lParam) Return $aRet[0] EndIf Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Local $iFlag = DllStructGetData($KBDLLHOOKSTRUCT, "flags") While $iFlag = 1 Switch $vkCode Case $SCROLL AbuseLang () Return 0 Case $PAUSE FoulLang () Return 0 Case $INSERT BadSpray () Return 0 Case $DELETE BadName () Return 0 Case $HOME AbuseKick () Return 0 Case $PAGEUP FoulKick () Return 0 Case $PAGEDOWN SprayKick () Return 0 Case $END NameKick () Return 0 EndSwitch WEnd EndFunc ;==>_KeyProc ;Warnings Below Func AbuseLang() $PlayerName = ClipGet() Send('y@ ' & $PlayerName & ', Please watch your language on our servers. Thanks.', 1) EndFunc ;==>AbuseLang Func FoulLang() $PlayerName = ClipGet() Send('y@ ' & $PlayerName & ', Please keep inappropiate content off of our servers. Thank you.', 1) EndFunc ;==>FoulLang Func BadSpray() $PlayerName = ClipGet() Send('y@@ ' & $PlayerName & ', Please do not spray your spray again in our servers. Thank you.', 1) EndFunc ;==>BadSpray Func BadName() $PlayerName = ClipGet() Send('y@@ ' & $PlayerName & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1) EndFunc ;==>BadName ;Kicks Below Func AbuseKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Repeated use of foul/abusive language"', 1) EndFunc ;==>AbuseKick Func FoulKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Repeated use of inappropiate language"', 1) EndFunc ;==>FoulKick Func SprayKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Inappropiate spray"', 1) EndFunc ;==>SprayKick Func NameKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Inappropiate name"', 1) EndFunc ;==>NameKick Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook) DllCallbackFree($pStub_KeyProc) EndFunc ;==>OnAutoItExitCheers,Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
AgentSmith15 Posted January 16, 2009 Author Posted January 16, 2009 I searched for the function which pointed me to this: http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx It appears you have to return 0. It works without high CPU, so I'm happy And as I said before, no need to use call. Check this out: expandcollapse popupGlobal Const $WH_KEYBOARD_LL = 13 Global Const $KEY = 257 Global Const $SCROLL = 91 Global Const $PAUSE = 19 Global Const $INSERT = 45 Global Const $DELETE = 46 Global Const $HOME = 36 Global Const $PAGEUP = 33 Global Const $PAGEDOWN = 34 Global Const $END = 35 ClipPut("") Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Global $hmod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($pStub_KeyProc), _ "hwnd", $hmod[0], _ "dword", 0) $hHook = $hHook[0] While 1 Sleep(20) WEnd Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $aRet = DllCall ("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _ "lparam", $lParam) Return $aRet[0] EndIf Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Local $iFlag = DllStructGetData($KBDLLHOOKSTRUCT, "flags") While $iFlag = 1 Switch $vkCode Case $SCROLL AbuseLang () Return 0 Case $PAUSE FoulLang () Return 0 Case $INSERT BadSpray () Return 0 Case $DELETE BadName () Return 0 Case $HOME AbuseKick () Return 0 Case $PAGEUP FoulKick () Return 0 Case $PAGEDOWN SprayKick () Return 0 Case $END NameKick () Return 0 EndSwitch WEnd EndFunc ;==>_KeyProc ;Warnings Below Func AbuseLang() $PlayerName = ClipGet() Send('y@ ' & $PlayerName & ', Please watch your language on our servers. Thanks.', 1) EndFunc ;==>AbuseLang Func FoulLang() $PlayerName = ClipGet() Send('y@ ' & $PlayerName & ', Please keep inappropiate content off of our servers. Thank you.', 1) EndFunc ;==>FoulLang Func BadSpray() $PlayerName = ClipGet() Send('y@@ ' & $PlayerName & ', Please do not spray your spray again in our servers. Thank you.', 1) EndFunc ;==>BadSpray Func BadName() $PlayerName = ClipGet() Send('y@@ ' & $PlayerName & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1) EndFunc ;==>BadName ;Kicks Below Func AbuseKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Repeated use of foul/abusive language"', 1) EndFunc ;==>AbuseKick Func FoulKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Repeated use of inappropiate language"', 1) EndFunc ;==>FoulKick Func SprayKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Inappropiate spray"', 1) EndFunc ;==>SprayKick Func NameKick() $PlayerName = ClipGet() Send('sm_kick ' & $PlayerName & ' "Inappropiate name"', 1) EndFunc ;==>NameKick Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook) DllCallbackFree($pStub_KeyProc) EndFunc ;==>OnAutoItExit Cheers, Brett Works great, but still I am not able to get the Scroll and Pause hotkeys to work. I double checked the virtual key codes and also checked that it was converted into decimal correctly as well. Does anyone have any ideas why IsPressed works, and SetWindows doesn't? [center][/center]
Spiff59 Posted January 16, 2009 Posted January 16, 2009 Does anyone know a good way to organize this script into a neater format? Array make prettier. Me like. expandcollapse popupGlobal Const $WH_KEYBOARD_LL = 13 Global Const $KEY = 257 Global $AllKeys[256][3] Local $UsedKeys[8][3] = [ _ [91, "y@" , "Please watch your language on our servers. Thanks."], _; SCROLL [19, "y@" , "msg2"], _; PAUSE [45, "y@" , "msg3"], _; INSERT [46, "y@" , "msg4"], _; DELETE [36, "sm_kick", "msg5"], _; HOME [33, "sm_kick", "msg6"], _; PAGEUP [34, "sm_kick", "msg7"], _; PAGEDOWN [35, "sm_kick", "msg8"]]; END For $i = 0 to 7 $AllKeys[$UsedKeys[$i][0]][0] = 1 $AllKeys[$UsedKeys[$i][0]][1] = $UsedKeys[$i][1] $AllKeys[$UsedKeys[$i][0]][2] = $UsedKeys[$i][2] Next ClipPut("") Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Global $hmod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($pStub_KeyProc), _ "hwnd", $hmod[0], _ "dword", 0) $hHook = $hHook[0] While 1 Sleep(20) WEnd Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $aRet = DllCall ("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _ "lparam", $lParam) Return $aRet[0] EndIf Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Local $iFlag = DllStructGetData($KBDLLHOOKSTRUCT, "flags") While $iFlag = 1 If $AllKeys[$vkCode][0] Then Send($AllKeys[$vkCode][1] & ClipGet() & $AllKeys[$vkCode][2], 1) ExitLoop EndIf WEnd EndFunc ;==>_KeyProc Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook) DllCallbackFree($pStub_KeyProc) EndFunc ;==>OnAutoItExit (Pardon, I was too lazy to cut-and-paste all the exact messages from the procs into the array)
AgentSmith15 Posted January 17, 2009 Author Posted January 17, 2009 Thanks, the array does make things more neater. Does anyone have any ideas to get the proper virtual key codes? I'm having problems with the Scroll button and Insert, and I am using a laptop. Any ideas? [center][/center]
AgentSmith15 Posted January 17, 2009 Author Posted January 17, 2009 Hmm, It's not a problem with with the virtual key codes but it's one with the script. No matter what keys I choose the first two keys never work. [center][/center]
ChangMinYang Posted January 17, 2009 Posted January 17, 2009 You seems going to build key-logger. Chat solution are just fake, 'pause' and 'scroll' keys are NOT necessary at normal solution.
AgentSmith15 Posted January 17, 2009 Author Posted January 17, 2009 You seems wrong, go away. I have no intentions of that nature, so begone from this thread. I'm making a script to help administrate my clan server easier. Unfortunate, CS:S blocks normal hotkeys so I have to resort to other methods. The first method IsPressed takes up alot of processing power. [center][/center]
Demonic Posted January 17, 2009 Posted January 17, 2009 According to:http://delphi.about.com/od/objectpascalide/l/blvkc.htmsome of your hexadecimal values for keys such as Insert and Scroll are wrong.. VK_INSERT 2D INS key as opposed to the 45 you hadVK_PAUSE 13 PAUSE key as opposed to 19 you hadSome of your others appear wrong and some others appear right.. I'm not exactly sure. I always used the VKC's from that list and my scripts using IsPressed() have always worked with the correct corresponding keys..
AgentSmith15 Posted January 17, 2009 Author Posted January 17, 2009 (edited) Well the reason they look wrong is I converted the numbers back to decimal from hexadecimal. I'll give the hex numbers a try... [EDIT] Sorry, but it looks like the numbers have to be decimal. AutoIt didn't like the Const 2D. Edited January 17, 2009 by AgentSmith15 [center][/center]
Demonic Posted January 17, 2009 Posted January 17, 2009 (edited) It always accepts them for me. I'll go check some of my scripts a second.. EDIT: It appears I always declared them as a string (the hexadecimals) as opposed to an integer which is how your consts are set up.. such as If _IsPressed("2D", $dll) Then Although that is with _IsPressed.. but IDK Edited January 17, 2009 by Arakard
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now