DragonBall Posted December 7, 2011 Share Posted December 7, 2011 I took from Yashied'sHotKey UDF the following script and put this into one of my own script, which is for obtaining the code of the pressed key by tooltip. I don't know how this works, i just remove the parts I don't need from Yashied'sHotKey UDF, and it works fine for my purpose. But when I typed each letter, it seems my editor window is lock ( I can't move it, or I can but with difficulity). Do you know the reason ?? expandcollapse popupGlobal $hkTb[1][12] = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, GUICreate('')]] Global $KeyCode _HotKey_Assign("") Func _HotKey_Assign($iKey, $sFunction = 0) Local $Index = 0, $Redim = False, $Error = False If $Index = 0 Then If ($hkTb[0][5] = 0) And ($hkTb[0][3] = 0) Then $hkTb[0][4] = DllCallbackRegister('__HK_Hook', 'long', 'int;wparam;lparam') $hkTb[0][5] = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hkTb[0][4]), _WinAPI_GetModuleHandle(0), 0) EndIf $Index = $hkTb[0][0] + 1 ReDim $hkTb[$Index + 1][UBound($hkTb, 2)] ;; Need this, otherwise, error with array dim. $Redim = 1 ;; Also need this, otherwise, no function. EndIf $hkTb[$Index][0] = $iKey For $i = 9 To 11 $hkTb[$Index][$i] = 0 Next If $Redim Then $hkTb[0][0] += 1 EndIf Return 1 EndFunc Func __HK_Hook($iCode, $wParam, $lParam) Local $vkCode = DllStructGetData(DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam), 'vkCode') Local $Key = BitOR(BitShift($hkTb[0][9], -8), $vkCode) $KeyCode=$Key ToolTip( $key ) Return EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2011 Share Posted December 7, 2011 Not being funny, but this just looks like a keylogger with tooltip instead. Is there a particular goal you want, perhaps there is a simpler way. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DragonBall Posted December 7, 2011 Author Share Posted December 7, 2011 the goal is when I type some keys(not all the keys, but still have 60 keys....), then the editor should save the file. I could use for and _ispressed to do this, but I think using the above script should be more efficients. Yes, one can use it as keylogger, but one still has to do a bit more work to get the letter from the keycodes. And if I want to use it as keylogger, I don't have to ask here ,since I don't need to care about if my editor is lock the position or not.... Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2011 Share Posted December 7, 2011 With regard your question, if you mean scite editor while the script is running, I have no problems with it at all. If not, you might want to clarify, for someone else who might be able to help you. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2011 Share Posted December 7, 2011 If I were doing what you are, I'd hotkeyset every key I needed like so. HotKeySet("1","_func") While 1 WEnd Func _func() HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) Send("{F9}") HotKeySet(@HotKeyPressed,"_func") EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DragonBall Posted December 7, 2011 Author Share Posted December 7, 2011 Thanks , JohnOne. I felt this maybe because I embedded my editor and viewer by Melba23's GUIFrame UDF. I found for the windows not embedd, no problem and even, not all windows embedded have this problem.... Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2011 Share Posted December 7, 2011 (edited) oops meant to add. HotKeySet("1", "_func") While 1 WEnd Func _func() If WinActive("MyWindow") Then HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) Send("{F9}") HotKeySet(@HotKeyPressed, "_func") EndIf EndFunc EDIT: there should be an Else condition in there, but you get the idea. Edited December 7, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DragonBall Posted December 7, 2011 Author Share Posted December 7, 2011 I have thought to do this before, but is this good? I mean set a lot of keys.....and I don't need these hotkeys for anything else but only when I type in this editor.....? what's you oppnion about this? Link to comment Share on other sites More sharing options...
kylomas Posted December 7, 2011 Share Posted December 7, 2011 hodgestructure, I suggest that you read the MS doc entitled "Installing and Releasing Hook Procedures" and then look at Yashieds code very carefully...I think that you are compromising the low level keyboard hook chain... kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
DragonBall Posted December 7, 2011 Author Share Posted December 7, 2011 @kylomas, I wonder why I am compromising the low level keyboard hook chain...? Link to comment Share on other sites More sharing options...
kylomas Posted December 7, 2011 Share Posted December 7, 2011 hodgestructure, Did you read the doc and look at EVERYTHING that Yahied does in his UDF??? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
DragonBall Posted December 7, 2011 Author Share Posted December 7, 2011 @kylomas, No, I don't have time to do this now and for me it's not easy at all. But if I am compromising something, I should correct it. The abvoe script is obtained from try and error to get the result I want, so I don't know the structure........... Link to comment Share on other sites More sharing options...
kylomas Posted December 7, 2011 Share Posted December 7, 2011 hodgestructure, Then I will close with this advice...run this code on your PC only!!! kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
DragonBall Posted December 8, 2011 Author Share Posted December 8, 2011 Sorry about this topic....The problem come froms controlclick, not as mentioned above Link to comment Share on other sites More sharing options...
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