Jump to content

Recommended Posts

Posted (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 by Jefrey

My stuff

  Reveal hidden contents

 

Posted

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
Posted

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,

  Quote

well, even if I disagree with this highly strict rule, we're part of this forum, we must accept the rules

Quite correct - so why bother mentioning your personal feelings? We are not going to change the rules just for you. ;)

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:

  Reveal hidden contents

 

Posted

Thanks, I didn't know about this rule about games... Just for a matter of curiosity... why is that not allowed?  :blink:

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:

shortcut.jpg

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  :D

Thank you guys!

My stuff

  Reveal hidden contents

 

  • Moderators
Posted

Jefrey,

 

  Quote

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

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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