Create Hotkey to use a previous Hotkey again

Get help with using AutoHotkey and its commands and hotkeys
IceTray
Posts: 7
Joined: 16 May 2018, 15:39

Create Hotkey to use a previous Hotkey again

17 May 2018, 14:57

Is there a way to create a hotkey that when pressed would use/call the hotkey that was previously pressed?

Simple Example:
I have three hotkeys.

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

1::MsgBox Hotkey-1

2::MsgBox Hotkey-2

3:: ;This hotkey should execute either hotkey 1 or 2, whatever was pressed before

Let's say I press hotkeys in the following order: 1, 1, 1, 2. When I press hotkey 3 now, it should execute hotkey 2 and the MsgBox with "Hotkey-2" would pop up.
Now I press hotkey in the following order: 1, 1, 1, 1, 2, 2, 2, 1, 1. If I press hotkey-3 now, it should execute hotkey 1 and the MsgBox with "Hotkey-1" would pop up.

Can something like this be done?
swagfag
Posts: 480
Joined: 11 Jan 2017, 17:59

Re: Create Hotkey to use a previous Hotkey again

17 May 2018, 15:31

ehhh, wouldnt recommend it but:
IceTray
Posts: 7
Joined: 16 May 2018, 15:39

Re: Create Hotkey to use a previous Hotkey again

17 May 2018, 16:27

Thanks!
Yeah, it seems unnecessary since you could just press the actual previous hotkey again. But, remaining with the example above, I want the third hotkey to execute the previous one and then execute other stuff after that as well.

Is there also a way for the third hotkey to execute the hotkey that was previous to the original previoulsly pressed hotkey? Sounds kind of confusing ^^

Again in an example:
Let's say I press hotkeys in the following order: 1, 1, 1, 2. When I press hotkey 3 now, it should execute hotkey 1 and the MsgBox with "Hotkey-1" would pop up.
Now I press hotkey in the following order: 1, 1, 1, 2, 2. If I press hotkey 3 now, it should execute hotkey 2 and the MsgBox with "Hotkey-2" would pop up.

Background:
I have to lable (=assign names to) a number of recorded 3D-trajectories with individual intended names frame for frame. In every frame there are multiple trajectories. Sometimes, already labeled trajectories become unlabeled in the next frame. To avoid redundant mouse movement & clicks etc., I want to lable one trajectory while hovering over it with the mouse and then pressing a hokey. Then I move to the next frame, hover over the same trajectory that got mistakenly unlabled (by the software) and press a hotkey that executes the previously pressed one (the one that labled the trajectory in the frame before) and also moves on to the next frame. The result would be, that I only have to hover over a trajectory and press that "execute-previous-hotkey-plus-move-to-next-frame" hotkey until there are no more frames left. Then I start at the beginning of the recording and do the same with a different trajectory.
Currently, I'm only missing the "previous to the previous" thing.

_________

Edit:
Now that I think about it... After pressing 2 of those "execute-previous-hotkey-plus-move-to-next-frame"-hotkeys, I would press that one again and call upon the hotkey I'm already pressing... Are there any solutions to that?

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 31 guests