Start from Scratch - Forum example failed

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Mathias
Posts: 1
Joined: 02 Feb 2023, 03:20

Start from Scratch - Forum example failed

Post by Mathias » 02 Feb 2023, 03:30

Hi Dears,

I'm 60 years now and don't know how to handle IRC or Discord, so I ask here, sorry if this is not correct.

I need (for health reasons) a Hotkey that puts my mouse cursor to the middle of the screen. I got an hint to use your program AutoHotkey and used the following code from your help section.

I did it and got an error. Please see below. Can anyone please help me to correct the code, please?

Code: Select all

#Requires AutoHotkey v2.0

!z::
CoordMode, Mouse, Screen
MouseMove, (A_ScreenWidth // 2), (A_ScreenHeight // 2)
return
Cargo.jpg
Cargo.jpg (39.73 KiB) Viewed 370 times

[Mod actions: Moved thread to v2 section and added [code][/code] tags. Please use them yourself when posting code.]

User avatar
boiler
Posts: 17081
Joined: 21 Dec 2014, 02:44

Re: Start from Scratch - Forum example failed

Post by boiler » 02 Feb 2023, 03:54

That is v1 code, but you are using v2. Here is a v2 translation:

Code: Select all

#Requires AutoHotkey v2.0

!z:: {
	CoordMode "Mouse", "Screen"
	MouseMove A_ScreenWidth // 2, A_ScreenHeight // 2
}

Make sure to use the v2 documentation.

Post Reply

Return to “Ask for Help (v2)”