Comments on: Send keystrokes to Zwift with AutoHotkey https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/ Make it easy to ride more.... Tue, 23 Mar 2021 09:16:05 +0000 hourly 1 https://wordpress.org/?v=7.0 By: Jesper [ZwiftHacks] https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1651 Tue, 23 Mar 2021 09:16:05 +0000 https://zwifthacks.com/?p=1086#comment-1651 In reply to Benson.

The AutoHotkey command OutputDebug is described here: https://www.autohotkey.com/docs/commands/OutputDebug.htm. You can use DebugView from Microsoft (linked at that page) to see the debug output. Alternatively you can use some other of the described debugging tools also linked there. Personally, I normally edit and debug with Visual Studio Code from Microsoft.

To access settings you have to simulate mouseclicks in the right places. The functions in zwift-hotkeys you are looking for are ZwiftClick / ZwiftClickCenter / ZwiftClickRight / ZwiftClickLeft. The different functions are there because there are differences in how screen elements move and scale (or not) when the Zwift window scales. ZwiftClickCenter are for elements which stay anchored to the center of the screen and only scale up to a certain point; *Right and *Left do similarly. It is easy to see which function is the right one to use if you put Zwift in window mode and resize the window so its is ultrawide (e.g. full screen width but only a quarter screen height).

There is already a click triggered by Backspace which will take you to the paused/menu screen so what you have to figure out is how to click in the spot which will open the Settings screen.

]]>
By: Benson https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1633 Sun, 21 Mar 2021 16:33:59 +0000 https://zwifthacks.com/?p=1086#comment-1633 This is great. I love messing around with this stuff. I am however, having a really hard time even just figuring out how to click on the settings button. I Want to be able to open the settings menu and preferably be able to adjust the Trainer Intensity on the fly (I ride a fixed gear, so it’s basically my gears). Even just a quick shortcut to the settings would be a good start, but following the code in the zwift_hotkeys does seem to trigger anything.

I tried enabling debugging, but where does the debug info show?

Thanks,
-Benson

]]>
By: Kesi [BHC] https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1576 Wed, 10 Mar 2021 17:06:08 +0000 https://zwifthacks.com/?p=1086#comment-1576 In reply to Kesi [BHC].

If I understand the matter to some extent, I have to be able to identify the hotkey for it. In my case this is an Elgato Stream Deck and I have no idea whether or how it can be addressed. (AutoHotStreamDeck could be a solution, but I’ll have to study computer science first.)

With a KeyDelayFactor between 20 and 30, the camera can be controlled to some extent even without a “return channel” by pressing several times.

]]>
By: Kesi [BHC] https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1573 Wed, 10 Mar 2021 11:08:14 +0000 https://zwifthacks.com/?p=1086#comment-1573 In reply to Jesper [ZwiftHacks].

So the camera is panned exactly for the predefined time, in this case 4 seconds and I get dizzy 🙂

It would be nice if Autohotkey recognizes how long the key is pressed in order to pan the camera for exactly that long.

]]>
By: Jesper [ZwiftHacks] https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1572 Wed, 10 Mar 2021 10:47:44 +0000 https://zwifthacks.com/?p=1086#comment-1572 In reply to Kesi [BHC].

It should be possible with something like this:

ZwiftSendKey(“0”) ; activate drone view
ZwiftSendKey(“{Left down}”) ; to press (and hold) the Left key
Sleep, 4000 ; sleep for 4 seconds
ZwiftSendKey(“{Left up}”) ; release the Left key

]]>
By: Kesi [BHC] https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1571 Wed, 10 Mar 2021 09:22:34 +0000 https://zwifthacks.com/?p=1086#comment-1571 Hi Jesper, many thanks for your solution! I’ve been looking for a way to use Zwift hotkeys without having to focus on Zwift itself for a long time.

One question: This script works well and reliably for pressing a key once. Can it also be adapted so that you can use it to control the camera in the drone view? The decisive factor here is how long the key is held down. Unfortunately, I failed terribly trying to use the endless possibilities of AutoHotkey. Thanks in advance!

]]>
By: Nick Keat https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1524 Wed, 03 Mar 2021 15:22:17 +0000 https://zwifthacks.com/?p=1086#comment-1524 In reply to Jesper.

Great, thanks very much for the help Jesper!

]]>
By: Jesper https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1522 Wed, 03 Mar 2021 06:43:11 +0000 https://zwifthacks.com/?p=1086#comment-1522 In reply to Nick K.

Use ZwiftSendKey(“{Down}”).

See the list of special key strokes you can send in the list at this page: https://www.autohotkey.com/docs/commands/Send.htm

]]>
By: Nick K https://zwifthacks.com/send-keystrokes-to-zwift-with-autohotkey/#comment-1519 Tue, 02 Mar 2021 23:47:30 +0000 https://zwifthacks.com/?p=1086#comment-1519 Hi Jesper. Thanks for this, I’ve used it to get my mini keypad to send space for power-up, 6 and 1 for view angles regardless of which program has the focus in Windows. Fantastic! However, I can’t get it to press the left, down or right arrows to change or choose direction – I tried ZwiftSendKey(“Down”) and ZwiftSendKey(Down). Can you help?
Thanks
Nick

]]>