Jump to content

Detecting key holding down, let up, and press down?


Recommended Posts

I wrote a little hotkey app that does things with crtl+a ("^a") or similar are pressed. But, this programs purpose was to speed up doing things, and each time i wish to execute one of these hot keys i have to let off the crtl key do use a hot key again. (i want it fast so that i can just hold the crtl button and hit the letters to the approperate functions) So I opened notepad and put a $CrtlPressed = 0; at the top of my program and went to try and figure out if i can find out the isPressed or isDown or isActivated states of the key, just about anything giving me the know of the current state of the key.

Anyhow, the end result that i want is the ability to hold down the crtl key and continue holding it to issue mutiple functions with crtl + letter combo's.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

I am running 3.2.2.0. While holding down crtl, it will not allow me to issue any new hotkey's. That test did'nt do anything on my computer, I ran it from desktop and from command prompt, and it did'nt do anything.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

>Running:(3.1.1.91):autoit3.exe "Test.au3"

!s

!a

!d

+>AutoIT3.exe ended.rc:0

well heres something i noticed... it says its running 3.1.1.91... i just reinstalled with the installer and told it to uninstall the old version. Bug report? I will attempt to remove AutoIt manually and install 3.2.2.0 again.

Excuse me, I chose 'beta run'. I've only used scite to edit up until this point.

>Running:(3.2.2.0):autoit3.exe Test.au3

!s

!a

!d

+>AutoIT3.exe ended.rc:0

Edited by Excalibur
Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

well now its running this code under 3.2.2.0 as it says, and i get the same result. Here is my little program.

HotKeySet("^z", "CloseTab");
while (1)
    Sleep(1);
WEnd
Func CloseTab()
    send("^{Tab}");
EndFunc

It is to close a tab in fire fox. open FF, and try to use it, open mutiple tabs, and try to close them all using ctrl+z holding down Z the whole time. it will only do one. Its not FF, because you can hold down ctrl and press tab as many times as you want and it will close them all.

Edited by Excalibur
Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

Version of FF? Umm.. 1.5.0.9

ERROR: syntax error

WinActivate

~~~~~~~~~~~^

I always have the sleep time much later, I set it to 1 to rule out mabey latence or something.

Edited by Excalibur
Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

Version of FF? Umm.. 1.5.0.9...

You might want to move up to 2.0.

ERROR: syntax error

WinActivate

~~~~~~~~~~~^...

Look in the help file for the proper syntax to use. I did not mean for you to place only that "word" into your script.

...I always have the sleep time much later, I set it to 1 to rule out mabey latence or something.

A HotKey will interrupt a sleep. You can set it very high.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Excuse me it wasnt ctrl-tab, it was crtl-f4, I was testing something. I assume you ment to insert something like this:

HotKeySet("^z", "CloseTab");
while (1)
    Sleep(1);
WEnd
Func CloseTab()
    $CurWin = WinGetHandle ("");
    WinActivate ($CurWin);
    WinWaitActive ($CurWin);
    send("^{f4}");
EndFunc

Which works very weirdly, it will do everything AFTER you let off the ctrl key, and works very akwardly.

Edited by Excalibur
Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein
Link to comment
Share on other sites

For FF v2.0, holding down the ctrl while FF is in focus opens a little search window in the lower left of the currect browser tab. That changes the focus for my testing. I tried this:

Opt("WinTitleMatchMode", 2)

HotKeySet("^z", "CloseTab");

While (1)
    Sleep(10000)
WEnd

Func CloseTab()
    WinActivate("Mozilla Firefox")
    WinWaitActive("Mozilla Firefox")
    Send("^{F4}")
EndFunc   ;==>CloseTab
but still got the search window. Maybe you will need to move away form Ctrl.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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...