Jump to content

Hotkey help


flick
 Share

Recommended Posts

im trying to make a macro that will do the following:

when i hit g hit f4 the same time

when i hit j hit f5 the same time

when i hit k hit f6 the same time

and i also want to know if it's possible to:

when f1 is hit "alt" is held down"

when f2/f3/f4 are hit alt is released

Link to comment
Share on other sites

im trying to make a macro that will do the following:

when i hit g hit f4 the same time

when i hit j hit f5 the same time

when i hit k hit f6 the same time

"The same time" doesn't make sense. The F-keys are not meta keys, they are separate key strokes that don't combine with g, j, or k. Sending an F-key instead of a letter is easy.

and i also want to know if it's possible to:

when f1 is hit "alt" is held down"

when f2/f3/f4 are hit alt is released

That just "{ALTDOWN}"/"{ALTUP}". Did you read the help file under Send()? Have you coded anything yet?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

(I was PM'd by flick, looking for more clarity on F-keys and "meta-keys".)

You can assign HotKeySet() functions to most of the F-keys. Some combinations are owned by system processes (i.e. Windows does not allow simulation of Ctl+Alt+Del) or other applications may have hooked that F-key already , so it's not a static rule on which ones you can and can't assign. Experiment in your environment, but in general, yes you can assign HotKeySet() functions to f-keys.

Remember that AutoIt is just another app to the Windows APIs, and another app might have taken control of the F-key as easily as AutoIt could.

By "meta-keys" I meant keys that are meant to be pressed at the same time with others to change their function (Shift, Alt, and Windows key "#", for example). You can select a meta-key as a modifier to any other key, and therefore achieve the effect of pressing both at the same time. For example: "!f" = Alt-f, "!{F4}" = Alt-F4. If you Send("!f"), it usually opens the File menu. If you Send("!{F4}"), it usually closes the active window. You can usually (but not always) hook these same meta-key and key combos to HotKeySet() functions to change their use to something else.

Letter keys like g, j, and k are not meta-keys. You can't hold down g and j together to get a new function, nor F4 and g, because they are not meta-keys. It is easy to HotKeySet() a function to the letter g so that F4 is sent instead of g, but you can't send F4 and g at the same time regardless, because they are not meta-keys.

Some Send() examples:

"!{F4}g" = Alt-F4, then g

"g{F4}" = g, then F4

"g+{F4}" = g, then Shft-F4

Also, though you didn't ask about it, there is a trap in setting HotKeySet() functions which has caused many posts on this forum: If you HotKeySet() a function to a key, and then Send() that key in the function, it will re-trigger the HotKeySet() function in a loop until the recursion error crashes your script. This is documented in the help file, but is still a common noob-snare.

Hope that helps explain what I meant.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...