CoordMode - How does it work?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Albireo
Posts: 1756
Joined: 16 Oct 2013, 13:53

CoordMode - How does it work?

28 Mar 2017, 07:22

As I can read from the helpfile, the instruction CoordMode, ToolTip|Pixel|Mouse|Caret|Menu [, Screen|Window|Client]
can affect how ahk-program will handle windows.

If CoordMode is defined, at the beginning of the AHK scripts.
Will the setting even apply in all functions?

If CoordMode used in a function.
Will the settings apply to all other functions and also the main program?

(If I understand correctly, it is possible to change CoordMode, how many times anywhere in a program)

//Jan
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: CoordMode - How does it work?

28 Mar 2017, 10:35

Albireo wrote:If CoordMode is defined, at the beginning of the AHK scripts.
Will the setting even apply in all functions?
Yes, it will be in effect unless local overwritten in the function.
Albireo wrote:If CoordMode used in a function.
Will the settings apply to all other functions and also the main program?
No only in the scope of the function.
Please excuse my spelling I am dyslexic.
just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: CoordMode - How does it work?

28 Mar 2017, 11:02

Capn Odin wrote:No only in the scope of the function.
Are you sure?

Code: Select all

#NoEnv
CoordMode, Mouse, Screen
MsgBox, 0, Current CoordMode Mouse, %A_CoordModeMouse%
Function()
MsgBox, 0, Current CoordMode Mouse, %A_CoordModeMouse%
ExitApp
Function() {
   CoordMode, Mouse, Client
}
Albireo, why don't you simply test it?
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: CoordMode - How does it work?

28 Mar 2017, 11:14

I was sure at the time and it seems to be the case

Code: Select all

#Persistent

CoordMode, ToolTip, Screen

SetTimer, Test, 100

Test:
	ToolTip, Something, 0, 0
return

x::Testfn("Screen")
z::Testfn("Client")

Testfn(str){
	CoordMode, ToolTip, % str
}
Please excuse my spelling I am dyslexic.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: CoordMode - How does it work?

28 Mar 2017, 12:58

Capn Odin wrote:
Albireo wrote:If CoordMode used in a function.
Will the settings apply to all other functions and also the main program?
No only in the scope of the function.
And yes it will, if the scope is the auto-execute section of the script ;) (as shown by just me)
User avatar
Capn Odin
Posts: 1352
Joined: 23 Feb 2016, 19:45
Location: Denmark
Contact:

Re: CoordMode - How does it work?

28 Mar 2017, 13:15

Oh ok, didn't really read the example, sorry.

I always declare them in the auto-execute section, so I didn't think about this possibility.
Please excuse my spelling I am dyslexic.
Albireo
Posts: 1756
Joined: 16 Oct 2013, 13:53

Re: CoordMode - How does it work?

29 Mar 2017, 09:40

When I test the program examples above, I got no result!
In which ahk version (Win OS 10?) is a_CoordModeMouse an variable? (not in mine version)
eample ToolTip doesn't work either

I think I understand the opportunities and the same reasoning and results should also apply to all other instructions as "SetKeyDelay" or "SetNumLockState" and so on.
just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: CoordMode - How does it work?

29 Mar 2017, 09:46

Open the online help, navigate to CoordMode, look for Remarks, and find:
[v1.1.23+]: The built-in A_CoordMode variables contain the current settings.
Albireo
Posts: 1756
Joined: 16 Oct 2013, 13:53

Re: CoordMode - How does it work?

29 Mar 2017, 11:30

Thanks!
(I have an older version and nothing about that in the help file - and in your example A_CoordModeMouse....)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Dewi Morgan and 391 guests