Timppa Posted December 30, 2015 Posted December 30, 2015 (edited) Hello!For my program, there is default "F1" for pausing the program, but as my Mac user friend somehow cannot use F1 because it does something else, I want to make a Function that sets the pause key to next pressed letter. I know it will use _IsPressed() method and so on, I can do all this by myself but I am not sure how to detect which button was sent?And no, I am not making a keylogger as many of you might think. It is alot of easier to make with another language And by the way, I have a label that says "Pause: " and then there is a input kind of box and when you press G for example, the input box has G in it, but the input box would not be editable, only changing if pressed a button and then pressing any keyboard key. However, if I do not find a solution, I could use that input box and make another button that has "Set" in it, just wondering if this is possible to "track" which keyboard is pressed.And I know the rest of the script, it would be this:Global $DefinePause HotKeySet($DefinePause, "Pause") Func Pause() ;The advanced pause code I got from this forum EndFuncThanks in advance! If it feels like I am breaking the forum rules (as this could be used as keylogger as well), then tell me and I just use the novice input box style EDIT: However, if the user sets F2 as pause button, it will not type it into the input box if I use it that way Edited December 30, 2015 by Timppa
InunoTaishou Posted December 30, 2015 Posted December 30, 2015 Sorry to say but it won't work on his Mac, AutoIt is windows. However, any one of these would solve your problem
Timppa Posted December 30, 2015 Author Posted December 30, 2015 I checked from google before I posted and saw no real solution for this; only what I found out was _Timer_GetIdleTime but I guess it interacts if your mouse has moved. I don't want to see any mouse movement since you cannot set mouse for pause.And yeah, that is why I want to make it customable pause. And I totally forgot, he has Windows on his Mac. This is also good if I want to change the button without opening the script folder and edit the script.
InunoTaishou Posted December 30, 2015 Posted December 30, 2015 (edited) Gives an example of when the hex key 23 is pressed. From the _IsPressed help filehttps://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htmHex 23 is "End"You would need call a function with a while loop that will wait until a key is pressed then assign it to your value. You don't have to record which key is pressed, just convert it to a char and assign it in HotkeysetThis example would work very well for any of the regular characters of the keyboard but you'll have to figure out how to get the Special characters (Esc, F1-F12, End, Insert, etc)<snip> Edited December 30, 2015 by Melba23 Removed code
Moderators Melba23 Posted December 30, 2015 Moderators Posted December 30, 2015 InunoTaishou,Once again you have posted code which scans the entire keyboard. For the last time I am limiting my involvement to pointing you to this announcement - any future posts contrary to the very clear guidance given in that thread will see you sanctioned.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Timppa Posted December 30, 2015 Author Posted December 30, 2015 InunoTaishou,Once again you have posted code which scans the entire keyboard. For the last time I am limiting my involvement to pointing you to this announcement - any future posts contrary to the very clear guidance given in that thread will see you sanctioned.M23So is the thing I asked for not allowed in this forum? If so, then I am sorry. Only wanted a function to set custom key.
Moderators Melba23 Posted December 30, 2015 Moderators Posted December 30, 2015 Timppa,As you can see from the announcement to which I linked, we have very strict limits on key "tracking". I fully realise that making a keylogger is not the intent (as you yourself highlighted in the OP) but if the resulting code performs essentially the same actions, then it falls under the same rules.M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Timppa Posted December 30, 2015 Author Posted December 30, 2015 Allright, I am sorry for asking it. I will try to make it by myself from now, got some idea how to do it now
Skysnake Posted December 31, 2015 Posted December 31, 2015 I dont understand. I have a little script that is linked to keyboard buttons. Like F1 to open Help - am I missing something? This should really not be difficult to do?Have you looked at this? Maybe I do not understand the problem.Wiki FAQ Why does the Ctrl key get stuck down after I run my script? Skysnake Why is the snake in the sky?
Timppa Posted January 1, 2016 Author Posted January 1, 2016 (edited) I dont understand. I have a little script that is linked to keyboard buttons. Like F1 to open Help - am I missing something? This should really not be difficult to do?Have you looked at this? Maybe I do not understand the problem.Wiki FAQ Why does the Ctrl key get stuck down after I run my script?im aa liltle durnk so i dont know if im stupd but how oes that has naything to do whit my scrpt?EDIT i mean with ths topic and happy new year t every1! Edited January 1, 2016 by Timppa
computergroove Posted January 1, 2016 Posted January 1, 2016 expandcollapse popup#include <misc.au3> #include <MsgBoxConstants.au3> #include <WinAPIvkeysConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $Input;Variable to set the pause function to HotKeySet("{PAUSE}","SetPause") While 1 Sleep(100) WEnd Func SetPause() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 253, 95, 292, 146) $Label1 = GUICtrlCreateLabel("Enter the key to be set to pause and click OK", 24, 16, 219, 17) $Input1 = GUICtrlCreateInput("", 40, 48, 49, 21) $OKButton = GUICtrlCreateButton("OKButton", 144, 48, 73, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OKButton $Input = GUICtrlRead($Input1) HotKeySet($Input,"Success") GUISetState(@SW_HIDE) EndSwitch WEnd EndFunc Func Success() MsgBox(0,"","Success") EndFuncHere's my attempt. It works. Press the pause key then set the hotkey to another variable. It's long winded but it works. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html
Danp2 Posted January 3, 2016 Posted January 3, 2016 I've used this UDF in the past with good results. Latest Webdriver UDF Release Webdriver Wiki FAQs
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