topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 7:44 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Question about AutoHotkey scripting  (Read 13852 times)

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Question about AutoHotkey scripting
« on: August 01, 2010, 01:03 PM »
Is it possible to create a hotkey that does not require simultaneous pressing of keys?

For example, I would like to create a hotkey combination that is based on pressing two keys in rapid succession like "KK" or "KL".

Thanks,
jdd

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #1 on: August 01, 2010, 01:12 PM »
you might try TapTap Hotkey Extender:
https://www.donation...dex.php?topic=5971.0

J-Mac

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 2,918
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #2 on: August 01, 2010, 03:33 PM »
you might try TapTap Hotkey Extender:
https://www.donation...dex.php?topic=5971.0

mouser,

Last update in November 2006? The download page claims it only works through XP. True?

Thank you.

Jim

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #3 on: August 01, 2010, 03:38 PM »
The download page claims it only works through XP. True?
lies!

J-Mac

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 2,918
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #4 on: August 01, 2010, 03:52 PM »
 :harhar:

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #5 on: August 01, 2010, 06:47 PM »
so.....is it correct to assume that it is not possible to create a hotkey combination in Autohotkey that is based on pressing two keys in rapid succession?

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #6 on: August 01, 2010, 07:50 PM »
so.....is it correct to assume that it is not possible to create a hotkey combination in Autohotkey that is based on pressing two keys in rapid succession?

no sure I'd so far as to say that, but I'm not sure how I'd approach it...

perhaps a hotkey for K that watches for a subsequent (K) key press within a defined period 

OkRob

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 19
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #7 on: August 01, 2010, 08:37 PM »
Not sure what you're trying to send by pressing the keys, but something like this works:

Code: Autohotkey [Select]
  1. :R*?:ttt::
  2. FormatTime, CurrentDateTime,, HH:mm
  3. SendInput %CurrentDateTime%
  4. return
Pressing the "t" 3 times sends the current time in HH:mm format

To send a text string, this works:

Code: Autohotkey [Select]
  1. :R*?:ppp::
  2. SendInput This is my string of text
  3. return
Typing "p" 3 times sends This is my string of text

Might try something along those lines if it will work for you. I use the ones above and others similar all the time to save me time with commonly typed text, etc. Note that I have them set to send after 3 keypresses as hardly any words I will ever type contain 3 of those letters in succession.
« Last Edit: August 01, 2010, 08:43 PM by OkRob »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #8 on: August 01, 2010, 09:03 PM »
Is it possible to create a hotkey that does not require simultaneous pressing of keys?

Here's one method to double-tap "k".

Code: Autohotkey [Select]
  1. ~k::
  2. {
  3.     {
  4.         MsgBox, Success.
  5.     }
  6. }
  7. Return


jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #9 on: August 04, 2010, 05:40 AM »
I should have been more specific.  What I want to do is to be able to type kk to simulate control-Alt-F4.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #10 on: August 04, 2010, 05:51 AM »
Code: Autohotkey [Select]
  1. ~k::
  2. {
  3.     {
  4.         SendInput, ^!{F4}
  5.     }
  6. }
  7. Return

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #11 on: August 05, 2010, 03:44 PM »
skwire,  That worked like a charm! :Thmbsup:

Can you show me the script to use kj to simulate control-Alt-F4?

Thanks,
jdd

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #12 on: August 07, 2010, 06:43 PM »
Mouser,

Can TapTap Hotkey Extender be used to simulate three simultaneous keystrokes such as Ctrl-Alt-F4 by tapping with one hand?  I couldn't seem to get the syntax right in the ini file.

Thanks,
jdd

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #13 on: August 09, 2010, 07:51 AM »
Do as OkRob suggested and use a hotstring:

Code: Autohotkey [Select]
  1. :*?:kj::
  2. {
  3.     SendInput, ^!{F4}
  4. }
  5. Return

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #14 on: August 09, 2010, 03:30 PM »
Can TapTap Hotkey Extender be used to simulate three simultaneous keystrokes
not sure what you are asking -- taptap can't detect a triple tap, only double taps (though this is possibly something that could be added); but it should be able to simulate combinations of 3 or more keys when triggered.

regarding taptap solution vs autohotkey solution, ahk is an incredibly powerful and versatile tool that can do tons of things.
wheras taptap was designed with one thing in mind, detecting these kinds of tapping keypresses as efficiently as possible with smallest impact on cpu and memory and resources.

this is something to care about because these are keypresses that are happening constantly as you type, and you don't want it slowing down your pc.

while i can't say definitively that taptap works more efficiently for this task, that would be my strong suspicion and i'd love to see some benchmarks comparing the two approaches.  though in truth it may be that the impact is minimal, when doing anything but heavy keyboard pounding, if even then.
« Last Edit: August 09, 2010, 03:33 PM by mouser »

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #15 on: August 09, 2010, 04:23 PM »
skwire, Thank you. That is what I was trying to do.  I am not trying to create hotstrings. 

The reason behind this query is that I am not very adept at using a keyboard.  For me, hot keys that require 3 keys pressed simultaneously (or even two) is very cumbersome.  Since I use a lot of hotkey combinations, the ability to create some using a one-hand 'tap tap' procedure is very powerful. 

Fortunately, I have two hands.  I can see how this would be a great tool for a person with one.

jdd

jdd

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 214
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #16 on: August 09, 2010, 05:44 PM »
Mouser,

I am trying to simulate/define hotkeys that normally require simultaneous pressing of three keys (e.g. Ctrl-Alt-Delete).  I would like to launch these hotkeys using a NON-SIMULTANEOUS pressing of two keystrokes. 

So in this example, I would like to define a sequence of two NON-SIMULTANEOUS (e.g. 'k' followed by 'j') to simulate 'Ctrl-Alt-Delete'. Do you follow?

Can I do this in TapTap Hotkey Extender?

OkRob

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 19
    • View Profile
    • Donate to Member
Re: Question about AutoHotkey scripting
« Reply #17 on: August 09, 2010, 06:04 PM »
If I am interpreting what you wish to do correctly, the script that skwire posted above will do exactly what you wish... hit k, release it then hit j and it will sent Ctrl-Alt-F4. Substitute {Delete} for {F4} and it wll send Ctrl-Alt-Delete if you hit k and then j. I would use a sequence like kkk though, as it's easier to send and a legitimate word containing kkk which would trigger your hotkey is less likely to occur.