Jump to content

IsPressed_UDF ! v2.3 | Advanced keypress


FireFox
 Share

Recommended Posts

I can post function like you say, but this would be keylogger and as mod says its forbidden thats why I keep it for me....

As mods agree so I will post this function without any 'bad mind' on it, its just for good cause :)

Cheers, FireFox.

Hi Firefox

I hope you can post/send it, as I really needs this kind of function and had no idea on how to do it...

Well, if au3 can control mouse, can send keys to any program, I can't see why anything will become more exposed into getting the keys (keyloger)

Hoping hear soon from you

Jose

Link to comment
Share on other sites

Hi Firefox

I hope you can post/send it, as I really needs this kind of function and had no idea on how to do it...

Well, if au3 can control mouse, can send keys to any program, I can't see why anything will become more exposed into getting the keys (keyloger)

Hoping hear soon from you

Jose

Why do you need a key logger?

8)

NEWHeader1.png

Link to comment
Share on other sites

I tried to make new function with lights keys but seems to doesn't work :)

; #FUNCTION# ===================================================================
; Name :          _IsLightKeyPressed
; Description:      Returns 1 if anylight keys are pressed
; Parameter(s):     None
; Requirement(s):   None
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
; Author(s):        FireFox
; Note(s):      None
;===============================================================================
Func _IsLightKeyPressed($vDLL = 'user32.dll')
    If __KeyPressCheck(14, 14, -1, $vDLL) Then Return 1
    If __KeyPressCheck(90, 91, -1, $vDLL) Then Return 1
    Return 0
EndFunc   ;==>_IsLightKeyPressedoÝ÷ ØLZ^jëh×6#include <IsPressed_UDF.au3>

; #Example# ===================================================================
; Name : _IsLightKeyPressed
; Parameter(s) : Returns 1 if anylight keys are pressed
; Author(s): FireFox
;===============================================================================

While 1
    If _IsLightKeyPressed() Then
        MsgBox(64, "_IsLightKeyPressed", "Key pressed !", 1)
    EndIf
WEnd

Cheers, FireFox.

Edited by FireFox
Link to comment
Share on other sites

@FireFox

About the example for _IsWhellKeyScroll()... The better way is to erase (set) $IsWhellKeyScroll variable to False, so when there is no input (after the msgbox is displayed), then next time the function will return False rather than True (to prevent constant display of the message box)...

While 1
    If _IsWhellKeyScroll() Then
        $IsWhellKeyScroll = False
        MsgBox(64, "_IsWhellKeyScroll", "Key scrolled !", 1)
    Else
        Sleep(10)
    EndIf
WEndoÝ÷ Øêò¢ç(ºWcºË©àzØ^~éܶ*'jëh×6Func _IsWhellKeyScroll()
    __WhellKeyScroll(0, 0, 0)
    If $IsWhellKeyScroll = True Then
        $IsWhellKeyScroll = False
        Return 1
    EndIf
EndFunc

And also i would bring up the global variables to the begining (top) of the include file, so other users can see them and take them in to acount when scripting :).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

@MrCreator

Thanks for reply, Msgbox always appears one time for me cos i move my mouse :)

I will fix it in next version with _IsLighKeyPressed if someone help me :o

Cheers, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Version 1.9 Availiable (see top post with update code)

Note : _IsTimeKeyPressed function added (count time of key pressed)

__DLL function added (open or close dll for key, by default 'user32.dll'; usefull if user use repetidly function keys)

Cheers, FireFox.

Link to comment
Share on other sites

:) found beug with _IsTimeKeyPressed :

It works only with '01' > LeftMouse key ...

Ive made an example with UP Arrow and for me it doesn't work :

#include <IsPressed_UDF.au3>

; #Example# ===================================================================
; Name : _IsTimeKeyPressed
; Parameter(s) : Check "26" time down key (UP arrow)
; Author(s): FireFox
;===============================================================================

While 1
$key = _IsTimeKeyPressed("26")
If $key <> -1 Then TrayTip('_IsTimeKeyPressed', $key, 2, 4)
WEnd

I will try to fix it or if someone find why it doesn't work :o

Cheers, FireFox.

Link to comment
Share on other sites

@FireFox

Again about the _IsWhellKeyScroll()...

Better way:

Global $IsWhellKeyScroll = False

Func _IsWhellKeyScroll()
    Local Const $WH_MOUSE_LL = 14
    
    Local $hCallback_KeyHook = DllCallbackRegister("__WhellKeyScroll_Callback", "int", "int;ptr")
    Local $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
    
    Local $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, _
        "ptr", DllCallbackGetPtr($hCallback_KeyHook), "hwnd", $hM_Module[0], "dword", 0)
    
    Sleep(100) ;Wait some moments until the variable is set by callback function
    
    If IsPtr($hCallback_KeyHook) Then
        DllCallbackFree($hCallback_KeyHook)
        $hCallback_KeyHook = 0
    EndIf
    
    If IsArray($hM_Hook) And $hM_Hook[0] > 0 Then
        DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
        $hM_Hook[0] = 0
    EndIf
    
    If $IsWhellKeyScroll = True Then
        $IsWhellKeyScroll = False
        Return 1
    EndIf
EndFunc   ;==>_IsWhellKeyScroll

Func __WhellKeyScroll_Callback($nCode, $wParam)
    Local Const $MOUSE_WHELLSCROLL_EVENT = 522
    Local $iEvent = BitAND($wParam, 0xFFFF)
    
    $IsWhellKeyScroll = ($iEvent = $MOUSE_WHELLSCROLL_EVENT)
    
    Return 0
EndFunc   ;==>__WhellKeyScroll_Callback

Only one global variable, and more stable check (the callback function should not set, or release itself :)).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Requirements: AutoIt v3.2 +

Incorrect info for the version with _IsWhellKeyScroll :) It's required at least AutoIt 3.2.10.0. Because 3.2.8.1 will fail due to lack of CallBack functions.

P.S

Tomorow i think i will post a version wich uses a little bit different approach (simpler to use) for such functionality (i am talking about the general udf functions).

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...