Jefrey Posted September 7, 2014 Posted September 7, 2014 (edited) Hi guys I own a basic Samsung notebook that does not have a num pad (not even integrated in alpha keys. It really brings nothing to use as num pad). And it's weekend, Independence Day (I'm from Brasil) and tomorrow's gonna be holiday in my city, so I can't buy a $12 USB numpad right now. I wanna run an application that requires exclusively some numpad keys. I started Googling about it, and I even found a project that adds a film over the touchpad, a 12 MB software installed and, after a hotkey, the touchpad starts working as numpad. A little crazy, I think (it's just a concept). I didn't know even that the touchpad allows the software to know what area has been touched (does it?). Anyway, this project is called Number Pad Film. After more unsuccessful searches, I had an idea to make something similar to it, but using the own keyboard. The user will assign hotkeys to every numpad key, so when the user presses that hotkey, the assigned key will be sent using Send() function normally ({NUMPAD0} - {NUMPAD9}). I didn't find anything about it, but if i'm recreating the wheel, please tell me. I will code a basic app that will just show a GUI up with a numpad made with buttons. The user will click a button and it will ask for the hotkey that the user wants to assign to that virtual key. Example: in the GUI, the user clicks "7", then something like "What hotkey do you want to assign to that key?" will be show, and the user must type the hotkey he wants. It's something like assigning a hotkey to some desktop shortcut: you don't actually write it. You press the hotkey and it detects. Furthermore, to make the code cleaner, I'd like to assign only one function for the "onclick event" of all the numpad buttons on the GUI. For example, I have all the 1-9 buttons on the GUI, but all those buttons will call just one function, for example, "myClickFunction". This function must detect which was the last button clicked, to get its label. Is there a way? If not possible, I guess the best option is using >SetOnEventA, but the way I explained above would be faster and cleaner. Just to have an idea on what I wanna do: #RequireAdmin #include 'onEventFunc.au3' SetOnEventA("^j", "numpadnum", $ParamByVal, "1") SetOnEventA("^k", "numpadnum", $ParamByVal, "2") SetOnEventA("^l", "numpadnum", $ParamByVal, "3") SetOnEventA("^u", "numpadnum", $ParamByVal, "4") SetOnEventA("^i", "numpadnum", $ParamByVal, "5") SetOnEventA("^o", "numpadnum", $ParamByVal, "6") SetOnEventA("^7", "numpadnum", $ParamByVal, "7") SetOnEventA("^8", "numpadnum", $ParamByVal, "8") SetOnEventA("^9", "numpadnum", $ParamByVal, "9") Func numpadnum($num) Send("{NUMPAD" & $num & "}") EndFunc While True Sleep(100) WEnd Thanks in advance! Edited September 7, 2014 by Jefrey My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt
Unc3nZureD Posted September 7, 2014 Posted September 7, 2014 What about a simple HotKeySet with a @HotKeyPressed macro? That's quite easy to do, however be careful please. Mods will probably lock your thread, since any kind of relation to a game is strictly forbidden. ( well, even if I disagree with this highly strict rule, we're part of this forum, we must accept the rules )
Moderators Melba23 Posted September 7, 2014 Moderators Posted September 7, 2014 Jefrey,Unc3nZureD makes a good point - but as your problem is essentially one of key mapping I am prepared to let it run. However I suggest amending the end of your first paragraph and being more careful in future. Unc3nZureD,well, even if I disagree with this highly strict rule, we're part of this forum, we must accept the rulesQuite correct - so why bother mentioning your personal feelings? We are not going to change the rules just for you. 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
Jefrey Posted September 7, 2014 Author Posted September 7, 2014 Thanks, I didn't know about this rule about games... Just for a matter of curiosity... why is that not allowed? I tried writing carefully since I know detecting keystrokes is what some guys want, to create keyloggers. But my goal is to create something like this: Note the "Shortcut key" field: the user must click it and press the hotkey he wants to assign to the shortcut (Microsoft Word, in this picture). So the user can choose any hotkey to assign to the virtual numpad keys. So I found the >HotKeyInput UDF. But it requires >HotKey UDF which doesn't support arguments. I'd like to use it with SetOnEventA, so I wouldn't have to repeat many functions. But it's a simple app with just a few keys, so that's not a problem right now. I couldn't find a way to convert the HotKeyInput hexcodes into Send()-like strings, like "!c" or "^c". If there's some way, please tell me Thank you guys! My stuff Spoiler My UDFs _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS · storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt
Moderators Melba23 Posted September 7, 2014 Moderators Posted September 7, 2014 Jefrey, why is that not allowed?It was discussed (for the umpteenth time) just a few weeks ago in this thread - although there are one or two small detours along the way. 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
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