Jump to content

Keyboard Assignments


Recommended Posts

Now I encounter many difficulties with keyboard assignments. As said before, I'm planning to do a macro collection where keys / key combinations trigger macros, depending on the current program.

I

Thus, my first idea was to use my Cherry 4700 keypad, because it's "programmable", i.e. that's a keypad with numerical 0...9, Plus, Minus, Enter, Comma / Point, NumLock, ./., *, Esc, Ctrl, Alt, Backspace, etc. keys that can assigned, by a Cherry software, key combinations like "a", "control-a", "control-shift-a", "control-shift-alt-a", and so on (and even macros but which are of no interest here since they don't have any scope, i.e. are always the same, whichever program is the current one, and that's exactly the task I need AI for: to trigger DIFFERENT macros with ONE key combination, depending on the current program).

Thus, my idea was, do "shift-alt-a" on numerical 1, "shift-alt-b" on numerical 2, and so on, this in the Cherry software.

Then, do an AI script INTERCEPTING those key combinations, and triggering the real macro, depending on other circumstances, i.e. AI would intercept the "shift-alt-a", and if the current program was program A, AI would trigger macro X, but if the current program was program B, AI would trigger macro Y, all from the same key pressing on my Cherry 4700 keypad.

In fact, this should be possible, but AI does NOT intercept those Cherry-triggered key combinations!

Thus, I tried the help file and the forum. I read, AI CANNOT assign functions to key combinations triggered by other programs!

OK now, next idea, I get rid of my Cherry keypad, and of the according program, and I get rid of Hot Keyboard, perhaps interfering (and which is to be replaced by AI anyway) - then I'll buy a Preh Cammander additional keyboard (= point-of-sales keyboards, with 30, 60, 84, 128 keys depending on your needs), and which represent the particularity that one you'll have assigned your "shift-alt-a" combination to, let's say, key number 84 there, this "shift-alt-a" is NOT reproduced by software every time you press that key, but it's "written" into the keyboard itself, which then will function WITHOUT any special software in run-time; thus, there is a real chance that AI, in spite of its "not possible to assign functions to other-software-driven key combinations" will indeed BE ABLE to trigger macros by such key pressings, which seems not to be the case with my Cherry 4700 keyboard and its special software running by run-time.

II

But now, I encounter a new, absolutely awkward problem, way before such sophistication: Even on my normal keyboard, AI does not trigger anything when I try to have it react to quite normal key combinations. Of course, simple F3, F5, F10, etc. work fine, but as soon as I assign key combinations, shift-alt-F3 or control-shift-F5 or anything, and the same with normal keys, such as control-alt-a, etc., AI simply does NOT react in any way to these triggers!

I know, they all say, AHK is far better than AI when it comes to shortkeys, but up to now, I thought this was meant to concern AHK's ability to even trigger short keys in the text, as a "text expander", i.e. you type $lw return, and AHK will make a "last will" out of it, etc.; I did NOT suppose that AI wouldn't even able to proceed normal key combinations, like "control-alt-a" or "shift-control-F4"?!

So, I am trying to replace the "A" with an "a", I'm trying to sort out the sorting of the codes, +^! or !^+ or in any other order, but to no avail, and I try those key settings in several softwares, in order to avoid that some software's idiosyncrasies will interfere when AI works fine with most other programs, but to no avail: Those key combinations just don't make AI do anything, anywhere I try.

As shown in my other thread this evening (= in Europe, that is), I placed the keyboard assignments on top of my running script, just beneath the global variable assignments and above the while / sleep thing, and in the correct form:

hotkeyset("{+!F3}", "A")

hotkeyset("{+^a}", "B")

etc., etc., and I've read somewhere that any given AI script cannot but proceed but up to 64 of such assignments; very well, that's not that many, but I encounter those difficulties here with just 20 or 30 of such assignments in my script.

Is there anything that I do in a false way here, is it a known issue with AI, or where to look for a solution of my problem?

Please let me, again, say, that I'd really prefer AI to AHK: I need real arrays (which AHK hasn't got), and I don't really need AHK's awful brackets - and help has been tremendous here.

But I need a solution for that problem of key (combination) assignments, even limited by 64.

III

a )

In order to give some more information that could be valuable to fellow users, I encountered this site,

http://cedeq.com/blog/automation/auto-hotkeys-for-autohotkey/

which speaks of an "Enterpad", but for AHK; in following the link to it, I get this page:

http://cedeq.com/enterpad-p120/autohotkey-english.html

where it says that it has 120 keys, and it costs 284 dollars in the U.S. and 299 dollars in Europe, plus VAT in Europe, so it's approaching the 400 dollars here.

By the way, for most users, and once you'll have assigned DIFFERENT macros to the SAME keys (= with the help of AI, that is), ease of use of the additional keyboard greatly prevails over its number of keys, i.e. an additional keyboard of just 60 or even just 30 keys would come infinitely more handy than a very big additional keyboard; the same applies to touchscreens, by the way.

b ) There's the above-mentioned Preh Commander, designed for the point of sale and extremely robust, not cheap, but not as expensive as the above-mentioned "Enterpad"; if AI could intercept simple commands from it (e.g. key 55 of it would trigger "shift-control-b", which in turn would trigger a macro = function in AI), the Preh Commander would perhaps be best buy and a long-life, handy tool.

c ) There's X-Keys, by x-keys.com, also in the price range of the Preh Commanded, but not readily available in Europe (whilst Preh Commander is); there seem to be some importers that take a little fortune for it, and direct import from the States would neither be easy nor be cheap. Functioning of it seems to be similar to Preh Commander: You LOAD the key assignments into the keyboard, and then they are available, without any program needed to be running by run-time (but I'm not certain here).

That's all I know of these matters, and that's more than most people know about it, so my hints might be helpful to fellow users. But where's the key to quite normal key combination assignments in AI which, by the help file, should be perfectly possible?

Let me add, finally, that I use a French-Swiss keyboard assignment in Win XP3 - perhaps key combinations in AI depend on your use of the "original" English keyboard? Just an idea...

Please give your valuable advice!

Link to comment
Share on other sites

hotkeyset("{+!F3}", "A")

This is idiotic, where did you learn this? Try this:

hotkeyset("+!{F3}", "A")

{F3} is the key. + ! are the modifiers. Don't combine and don't mix them up.

Same here:

hotkeyset("{+^a}", "B")

hotkeyset("+^a", "B")

By the way, lw expanding into "last will" can be done with this:

By the way 2, the limit of 64 was removed a loooong time ago.

Edited by Manadar
Link to comment
Share on other sites

I

Thank you a lot, Manadar, and I see your great work (with Garry Frost as second author) in autotextmain (which I'll adopt much later on, but which is unvaluable to have since it makes AI a COMPLETE system, without that lack it seemed to present vàv. AHK before your work that cannot be underestimated).

I've had some difficulties in understanding the hotkeyset / send commands' syntax since examples with modifiers were sparse. Thus, rounded brackets are needed with F keys and other system keys, while they are forbidden with character keys (a-z), and if there are, modifiers must not be included in them, thus:

hotkeyset("+^{F3}", "A")

hotkeyset("+^a", "A")

(And in the send command, parameter 0 (=default) if there are modifiers included.)

Now this is perfectly clear for me while it was not at all before your kind answer (i.e. not from the help file, nor from the forum, where, btw, you got 37 hits for sethotkey, but none for hotkeyset...). Thanks! (And Happy Easter from Wallonia to the Netherlands!)

II

And since this works like a charm now, I went back to my original idea, putting in "Cherry Designer version 4.3.3", for my Cherry keypad G84-4700, "software macros" that are nothing but ShiftControlAlt-a ... ShiftControlAlt-z (= some less than that since the keypad doesn't have but 21 keys), and into my AI script, I put a long list,

hotkeyset("+^!a", "A")

hotkeyset("+^!b", "B")

hotkeyset("+^!c", "C")

hotkeyset("+^!d", "D")

hotkeyset("+^!e", "E")

hotkeyset("+^!f", "F")

hotkeyset("+^!g", "G")

hotkeyset("+^!h", "H")

hotkeyset("+^!i", "I")

hotkeyset("+^!j", "J")

hotkeyset("+^!k", "K")

hotkeyset("+^!l", "L")

hotkeyset("+^!m", "M")

hotkeyset("+^!n", "N")

hotkeyset("+^!o", "O")

hotkeyset("+^!p", "P")

hotkeyset("+^!q", "Q")

hotkeyset("+^!r", "R")

hotkeyset("+^!s", "S")

hotkeyset("+^!t", "T")

hotkeyset("+^!u", "U")

hotkeyset("+^!v", "V")

hotkeyset("+^!w", "W")

hotkeyset("+^!x", "X")

hotkeyset("+^!y", "Y")

hotkeyset("+^!z", "Z")

(Sorry for putting it here in full length, but you might be interested in copying it, so I wanted to spare you the effort to replace the characters.)

And then I tried if AI was able to intercept those key combinations (and that are, again, not sent to the system by the hardware (= no eprom in the keypad), but indeed by some Cherry software in-between) in order to process them...

And you got it already: I wouldn't have posted the list above if it didn't!

Thus, my advice, buy a Cherry G84-4700, it's available both in the States and in Europe without difficulty and for around 40 dollars / euros, and it's perfectly sturdy, will probably live out several of your comps (while the aformentioned Enterpad for 300 dollars or more doesn't even seem to have real keys but just tapping zones, which normally isn't that sturdy a concept).

From then on, if really some day you need more than 21 (again, very long-lasting) keys, you could buy then some of the other solutions, but then, AI allows us to assign MULTIPLE macros to EVERY ONE of those 21 keys, depending on various global variables, i.e. not only by application scope, but then, within any application, depending on the circumstances of your work.

I think, then, Cherry G84-4700 (available in black and an unfortunately very broken white only) with AutoIt is the perfect tool for everyone; it certainly will now be for me!

Link to comment
Share on other sites

I've had some difficulties in understanding the hotkeyset / send commands' syntax since examples with modifiers were sparse. Thus, rounded brackets are needed with F keys and other system keys, while they are forbidden with character keys (a-z)

The HotKeySet page clearly redirects anyone (with a convenient clickable link) to the Send page where the format is described for key assignment. At the Send page I see this example stand out:

Send("{TAB}") ; Tab
Send("+{TAB}") ; Shift + Tab
Send("^{TAB}") ; Ctrl + Tab
Send("^+{TAB}")  ; Shift + Ctrl + Tab

I don't know how we can make this any more clear.

And forgive me if I am being rude, I just don't like to go over a 2000 word question in my spare time that can be asked in 5 words with a little code example.

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

  • Recently Browsing   0 members

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