Jump to content

HotKeyInput Issue


Recommended Posts

Hi to all,

i dont know why the other topic was closed, as you can see i dont ask nothing about a keylogger!

I want an input control where the user of my application could set a hotkey by simply clicking in a box and pressing a key for example CTRL+SHIFT+A.

An user tell me that HotKeyInput.au3 do the job...and it's true!

I run this example:

#Include <GUIConstantsEx.au3>
#Include <HotKeyInput.au3>

Global $Form, $ButtonOk, $HotkeyInput1, $HotkeyInput2, $GUIMsg
Global $t

$Form = GUICreate('Test', 300, 160)
GUISetFont(8.5, 400, 0, 'Tahoma', $Form)

$HotkeyInput1 = _GUICtrlCreateHotKeyInput(0, 56, 55, 230, 20, -1, -1, ' - ')
$HotkeyInput2 = _GUICtrlCreateHotKeyInput(0, 56, 89, 230, 20)

_KeyLock(0x062E) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows

GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14)
GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14)
GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28)
$ButtonOk = GUICtrlCreateButton('OK', 110, 124, 80, 23)
GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS))
GUISetState()

While 1
    $GUIMsg = GUIGetMsg()

    Select
        Case $GUIMsg = $GUI_EVENT_CLOSE
            Exit
        Case $GUIMsg = $ButtonOk
            $t = '   Hotkey1:  0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)), 4) & '  (' & GUICtrlRead($HotkeyInput1) & ')   ' & @CR & @CR & _
                 '   Hotkey2:  0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput2)), 4) & '  (' & GUICtrlRead($HotkeyInput2) & ')   '
            MsgBox(0, 'Code', $t, 0, $Form)
    EndSelect
WEnd

Now for example if i digit CTRL+ALT+C key, the output give me this string : 0x0343. How i can convert this string to an hotkeys valide string?

Hi

Edited by StungStang
Link to comment
Share on other sites

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/

Do not create a new topic on a subject if a previous topic on that subject was locked.

Edited by Maffe811

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

  • Moderators

StungStang,

This thread explains why the original topic was closed - and as you can see it was nothing to do with your request. So this thread is perfectly OK. Now all you have to do is wait until someone answers your question. :)

Maffe811,

Please do not take this as an attack on your earlier post - you obviously had not read the linked topic. In general you are quite correct to point out that members should not repost questions that were in locked threads, but here we have the exception that proves the rule. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You can make a formatting function to get the input text and format it to shortcut valid format which you can find in the help file(hotkeyset, send)

I made entire setup for myself without using this lib you mention so bare with me... You can do something like this

Select
        Case StringInStr($inputcode, "+")
            $transformed = StringReplace($inputcode, "+", "")
            ContinueCase
        Case StringInStr($inputcode, "CTRL")
            $transformed = StringReplace($transformed, "CTRL", "^")
            ContinueCase

        Case StringInStr($inputcode, "ALT")
            $transformed = StringReplace($transformed, "ALT", "!")
            ContinueCase
        Case StringInStr($inputcode, "SHIFT")
            $transformed = StringReplace($transformed, "SHIFT", "+")

        Case Else
            $transformed = $inputcode
            ConsoleWrite("hotkey is keyboard-normal > " & $transformed & @LF)
    EndSelect

$hotkey = StringLower($transformed)

$input code should be text that is placed in the input box, i have no idea how this lib places it in the input box in what text format so modify the select code accordingly

Edited by Aktonius
Link to comment
Share on other sites

Th UDF you are using has all the info you need in the thread it is posted

You use _HotKeyAssign() function, instead of hotkeyset()

If you need the actual keys that were pressed, then you are indeed wanting a keylogger.

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

Maffe811,

Please do not take this as an attack on your earlier post - you obviously had not read the linked topic. In general you are quite correct to point out that members should not repost questions that were in locked threads, but here we have the exception that proves the rule. :)

M23

Yes, i see that now!

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Th UDF you are using has all the info you need in the thread it is posted

You use _HotKeyAssign() function, instead of hotkeyset()

If you need the actual keys that were pressed, then you are indeed wanting a keylogger.

I want simple use the HotKeySet() autoit function. Please stop with this damn keylogger, is too much stupid saying always the same think.
Link to comment
Share on other sites

I want an input control where the user of my application could set a hotkey by simply clicking in a box and pressing a key for example CTRL+SHIFT+A.

You have all the information you need then, because _hotkeyassign will do just that.

Right ?

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

  • Moderators

StungStang,

Do not get upset, we understand that you are not trying to create a keylogger, but by asking for that code to be translated you are actually transforming the code into a keylogger. :)

As JohnOne has pointed out, you do not use HotKeySet with this UDF, you use _HotKeyAssign - that way you do not need to translate the key code and everything remains legal. ;)

All clear? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

So you want the keys that were pressed literal, and not to set a hotkey combination, and that my friend is a keylogger.

There are no two ways about it.

But for the record, even that information is in the thread.

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

So you want the keys that were pressed literal, and not to set a hotkey combination, and that my friend is a keylogger.

There are no two ways about it.

But for the record, even that information is in the thread.

There is a misunderstanding. For example if in the hotkeys input box there is written ALT + C, the _GUICtrlReadHotKeyInput() give me that code : 0x0243, i want simply translate this in "!c". That's why with the "!c" string i can use HotKeySet. I dont want use _HotKeyAssign just why i have to add another library, it seems more difficult than HotKeySet to manage. Where do you see a keylogger? :)
Link to comment
Share on other sites

"give me that code : 0x0243, i want simply translate this in "!c" "

You will need another library to do that, so its not a problem for you.

If you truly cannot see the keylogger implications now, its doubtful you ever will, so there is no point in banging on about it.

Over and out.

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

I might seem like devils advocate here but all the keylogging paranoia to me seems pointless since everything is already included in Autoit by those who want to make keylogger.

Basically this udf mentioned should keylog as well but it doesnt do it for malicious purpose.

Just my 2coins

Edited by Aktonius
Link to comment
Share on other sites

Well if they want to make a keylogger they can do that and stay away from the forum.

This person, does clearly not want to make a keylogger, but the way he wants to do it makes the code a possible keylogger base.

Also JohnOne has already written a way to do this without making the code Keylogger-friendly.

You have all the information you need then, because _hotkeyassign will do just that.

So it seems like the OP is to stubborn to accept JohnOne's suggestion, wich could meant he really wants keylogger-friendly code.

I dont think so, but then what he wants to do is achivable by _Hotkeyassign.

Edited by Maffe811

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

This keylogging paranoia is fun!...Is so much difficult to do a keylogger with _IsPressed command?.

Is that strange that i would NOT use another library, its strange that i would to make the script light and much more readable for me?...Why i have to using another library when autoit can do it with the standard function?.

Is this code !c much readable than an hex code like that 0x0243?

I just want use the standard autoit syntax.

Just stop saying the same think, use that use that ect... I want convert this hex code to the standard "Send" string, like !c.

If you can help me well, if you want to post again use _hotkeyassign, etc...please dont dirty my topic, there is just too much bullshit message here.

Edited by StungStang
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...