Mouse switch part 3

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Mouse switch part 3

19 Oct 2020, 08:36

Another issue in your code is where you have the following (and others like it and without parentheses as well):

Code: Select all

	if (togglevalue = left_hand)

It should be:

Code: Select all

	if (togglevalue = "left_hand")

It doesn’t seem like it would be useful to show overall fixes to your code since you rewrite them into your style (with problems), so I won’t try to fix the rest. You can post your new code after implementing Hotkey with specific problems you incur at that point. Read the documentation carefully and try to follow the syntax described.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

20 Oct 2020, 12:41

Hi all (and especially @boiler and @mikeyww ),
I read your posts and thought a lot about it. But, I wont give up.
I appreciate your help so far VERY much. I would appreciate it also if you keep supporting me.
I know this may be frustrating to you, since we might not exactly speak on the same frequency, but I am willing to learn, and learning.
I learned programming indeed in linear style, Pascal in that time, about 30 years ago.
Also, I learned to write a PSD (Programming Structure Diagram) at front before programming, also called https://en.wikipedia.org/wiki/Nassi%E2%80%93Shneiderman_diagram. Personaly, this helps to write and understand code.

So, what I did was write the PSD for this:

Image

(just for curiosity: have you ever heard of this kind of diagram? do you use it?)

Also, what I thought of, the only thing what is missing so far, is that Autohotkey cant currently cope with hotkeys in functions, right?
so, it might be wise for me to post a feature request.

Note also: I have not looked at your latest posts regarding DLL or hotkey approach - will do soon.

Please share your comments, I really need it and appreciate it.

Thanks,
Last edited by mgroen on 20 Oct 2020, 13:01, edited 2 times in total.
User avatar
mikeyww
Posts: 26592
Joined: 09 Sep 2014, 18:38

Re: Mouse switch part 3

20 Oct 2020, 12:53

Actually you can enable or disable hotkeys within functions. That would be done with the Hotkey command.
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Mouse switch part 3

20 Oct 2020, 13:04

A couple other things I noticed about these lines in your code:

Code: Select all

switch_value := left_hand, right_hand
; ...
switch_value := !switch_value
The top line is not valid. You cannot simultaneously assign/define opposite values or a range of values like that. You would start with one value, and it would have to be a literal string (at least the way you are trying to use it), like this:

Code: Select all

switch_value := "left_hand"
And then when you want to switch the other value, instead of assigning it !switch_value (which would be a great way to do it if you were instead using values of 1/0 or True/False), you would have to determine which one it is and then make it the opposite, which is obviously much more cumbersome and why you really should do it the way we showed you:

Code: Select all

switch_value := switch_value = "left_hand" ? "right_hand" : "left_hand"
or its equivalent:

Code: Select all

if (switch_value = "left_hand")
	switch_value : = "right_hand"
else
	switch_value := "left_hand"
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

21 Oct 2020, 07:39

@boiler , @mikeyww :

I tried to produce working code. Its got no errors, but it doesn't do it well.
Tried to use Hotkey like @mikeyww said, in combination with labels, defining a label for the 2 mouse buttons on left/right hand usage. But its really no good, I get undesired mouse clicks.. Well.. at least it's code I wrote myself and understand...

Could you please take a look at it and pleas help me?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

sleep_duur_left := 10000
sleep_duur_right := 10000
switch_value := 0,1 ; 0= right, 1 = left

cursor_left = D:\mouse\ARROW_RED_LEFT.cur
cursor_right = D:\mouse\ARROW_GREEN_RIGHT.cur

Hotkey, LButton, mouse_right_left_button
Hotkey, RButton, mouse_right_right_button
Hotkey, Lbutton, mouse_left_left_button
Hotkey, Rbutton, mouse_left_right_button


loop
{
	if switch_value = 0
		{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to RIGHT hand
		Sleep, 5000
		SplashTextOff

		Gosub, mouse_right_left_button
		Gosub, mouse_right_right_button	

		sleep, sleep_duur_left
		}

	if switch_value = 1
		{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to LEFT hand
		Sleep, 5000
		SplashTextOff

		Gosub, mouse_left_left_button
		Gosub, mouse_left_right_button

		sleep, sleep_duur_right
		}

switch_value := !switch_value
}

mouse_right_left_button:
{
	Send, % "{LButton down}"
	Keywait, LButton
	Send, % "{LButton up}"
	return
}	

mouse_right_right_button:
{
	Send, % "{RButton down}"
	Keywait, RButton
	Send, % "{RButton up}"
	return
}	

mouse_left_left_button:
{
	Send, % "{RButton down}"
	Keywait, RButton
	Send, % "{RButton up}"
	return
}

mouse_left_right_button:
{
	Send, % "{LButton down}"
	Keywait, LButton
	Send, % "{LButton up}"
	return
}

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

Re: Mouse switch part 3

21 Oct 2020, 07:49

Inside the loop, you don’t want to gosub to those labeled routines. You want to use the Hotkey command to turn on/off the hotkeys depending on the value of your toggle variable. You also don’t need routines to send left when left is pressed and right when right is pressed. You just need to turn off the hotkeys that cause the opposite to be sent (when the toggle is off).

By the way, this does nothing but assign 0, not a range of two possible values:

Code: Select all

switch_value := 0,1
You don’t need it to be anything than 0 anyway. When you assign !switch_value, it becomes 1 and then 0 when you do it again.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

22 Oct 2020, 02:49

boiler wrote:
21 Oct 2020, 07:49
Inside the loop, you don’t want to gosub to those labeled routines. You want to use the Hotkey command to turn on/off the hotkeys depending on the value of your toggle variable. You also don’t need routines to send left when left is pressed and right when right is pressed. You just need to turn off the hotkeys that cause the opposite to be sent (when the toggle is off).

By the way, this does nothing but assign 0, not a range of two possible values:

Code: Select all

switch_value := 0,1
You don’t need it to be anything than 0 anyway. When you assign !switch_value, it becomes 1 and then 0 when you do it again.
So, I need use the function Hotkey, which creates/modifies a hotkey...
as described on

Code: Select all

https://www.autohotkey.com/docs/commands/Hotkey.htm
I read the info on the page above but really, this documentation is hard to understand for non experienced (Autohotkey) programmers, just like all the docs on autohotkey.com (but thats a side note).

according to the syntax I would need to use
Hotkey, Keyname in both the ifs in the loop
but how to link that to the Send command, without getting underised mouse clicks?

is there any example of how to use Hotkey command in combination with mouse buttons and the send command?
User avatar
mikeyww
Posts: 26592
Joined: 09 Sep 2014, 18:38

Re: Mouse switch part 3

22 Oct 2020, 05:48

Follow my earlier instructions about Hotkey. Example is below. You can put whatever commands you want in the subroutines.

Code: Select all

Hotkey, F3, Test, On
MsgBox, 0, Starting, Press OK and then F3.
Return

Test:
Hotkey, F3, Test2
MsgBox, 64, Test, I'm on! Press OK and then F3.
Return

Test2:
Hotkey, F3, Off
MsgBox, 48, Test2, I'm different! Press OK and then F3.
Send 123
MouseMove, 200, 200
Return
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Mouse switch part 3

22 Oct 2020, 07:15

mgroen wrote:
22 Oct 2020, 02:49
but how to link that to the Send command, without getting underised mouse clicks?
It won’t send undesired mouse clicks because the Hotkey command would just be turning the hotkey on and off. It would only send when you press the hotkey. You were getting extra mouse clicks because you were performing a Gosub to the routine where it sends, which doesn’t make sense. By using Hotkey to activate/deactivate the hotkey, it only makes it available to send when it is pressed (or turning it off so it won’t). The Hotkey command doesn’t itself actually execute the subroutine defined by it.

You need to think about event-driven programming correctly. When you set up hotkeys, that doesn’t execute what you would have the hotkey do. You are just setting it up so it will be executed when the event occurs that the hotkey is pressed. You are thinking like things happen when your code flow tells it to. Your code just sets up the situation for certain code to be triggered by a hotkey press.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

11 Nov 2020, 10:20

@boiler , @mikeyww

I updated the code (to my style), and your tips...I think I am almost there.
But it gets stuck on the disabling of the hotkeys

could you take a look?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Pauze_interval := 20000 ; 10 seconds
sleep_duur_left := 3000 ; 3 seconds
sleep_duur_right := 4000 ; 4 seconds
switch_value := 0
cursor_right = D:\mouse\ARROW_GREEN_RIGHT.cur
cursor_left = D:\mouse\ARROW_RED_LEFT.cur


loop {

	if switch_value = 0
	{
	SplashTextOn, 300, 100, Mouse switch, switch mouse to RIGHT hand
	Sleep, 5000
	SplashTextOff
	
	SetSystemCursor(cursor_right) ; Code voor muiscursor switch
	
	button_toggle(switch_value)
	
	sleep, sleep_duur_right
	}

	if switch_value = 1
	{
	SplashTextOn, 300, 100, Mouse switch, switch mouse to LEFT hand
	Sleep, 5000
	SplashTextOff

	SetSystemCursor(cursor_left) ; Code voor muiscursor switch

	button_toggle(switch_value)

	sleep, sleep_duur_left
	}

switch_value := !switch_value
Sleep, Pauze_interval
} 

; function_definitions:

button_toggle(togglevalue) {
	
	if (togglevalue = 1)
	{
	Hotkey,LButton,label1
	Hotkey,Rbutton,label2

	label1:
	Send % "{RButton down}"
	KeyWait, LButton
	Send, % "{RButton up}"
	return

	label2:
	Send % "{LButton down}"
	KeyWait, RButton
	Send, % "{LButton up}"
	return
	}

	if (togglevalue = 0)
	{
	Hotkey,Lbutton, off
	Hotkey,Rbutton, off	
	}

}


SetSystemCursor(file) {
 CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 Loop, Parse, Cursors, `,
 {
  DllCall( "SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield )
 }
}

User avatar
mikeyww
Posts: 26592
Joined: 09 Sep 2014, 18:38

Re: Mouse switch part 3

11 Nov 2020, 11:14

Below is an example of what you can do.

Code: Select all

F3::buttonsWait(toggle := !toggle)
F4::
SoundBeep, 800, 20
ExitApp

buttonsWait(enable) {
 If enable {
  Hotkey, LButton, LB, On
  Hotkey, RButton, RB, On
  SoundBeep, 1500, 20
 } Else {
  Hotkey, LButton, Off
  Hotkey, RButton, Off
  SoundBeep, 1000, 20
 }
}

LB:
SoundBeep, 1500, 20
Send {RButton down}
KeyWait, LButton
Send {RButton up}
Return

RB:
SoundBeep, 1200, 20
Send {LButton down}
KeyWait, RButton
Send {LButton up}
Return
This script will probably generate unintended effects. Imagine what happens when you press and release LButton: first, RButton is pressed down. When LButton is released, RButton is released. This shows the context menu. If you then press LButton, the whole thing is repeated, and you display the context menu again.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

13 Nov 2020, 16:05

@mikeyww , @boiler

Finally got it all working! :)
Thanks a lot both of you!!
Without your patience and help I couldn't have made it this far!! Really, thanks a really lot!

Here is the code (which I designed and wrote myself and understand it :)):

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Pauze_interval := 900000 ; 15 min. 
Pauze_duur:= 20000 ; 20 sec.
switch_value := 0
cursor_right = D:\mouse\ARROW_GREEN_RIGHT.cur
cursor_left = D:\mouse\ARROW_RED_LEFT.cur


loop
{
	if switch_value = 0
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to RIGHT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_right) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}

	if switch_value = 1
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to LEFT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_left) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}
	switch_value := !switch_value
	Sleep, Pauze_interval
} 

; function_definitions:

button_toggle(togglevalue) {
	
	if (togglevalue = 1)
	{
		Hotkey,LButton,label1
		Hotkey,RButton,label2

		label1:
		Send % "{RButton down}"
		KeyWait, LButton
		Send, % "{RButton up}"
		return

		label2:
		Send % "{LButton down}"
		KeyWait, RButton
		Send, % "{LButton up}"
		return
	}

	if (togglevalue = 0)
	{
		Hotkey,LButton,label3
		Hotkey,RButton,label4

		label3:
		Send % "{LButton down}"
		KeyWait, LButton
		Send, % "{LButton up}"
		return

		label4:
		Send % "{RButton down}"
		KeyWait, RButton
		Send, % "{RButton up}"
		return
	}
}

SetSystemCursor(file)
{
	CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 	Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 	Loop, Parse, Cursors, `,
 	{
  		DllCall( "SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield )
 	}
}

Next challenge would be to display the remaining time (counting down value) before switch, so basically the value of Pauze_duur and Pauze_interval in some sort of mini windows (for example just above windows taskbar time display)... do you know if this is possible with autohotkey?
User avatar
mikeyww
Posts: 26592
Joined: 09 Sep 2014, 18:38

Re: Mouse switch part 3

13 Nov 2020, 16:37

I'm glad that it works.

Displaying things can be done with MsgBox, ToolTip, Gui, or SplashText. They are all described in the documentation. They are generally easy; Gui is potentially the most complex but also has the most flexibility and options. For a simple kind of temporary "time display", tooltip often meets the need.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

13 Nov 2020, 16:59

Thanks once again, @mikeyww for the directions. I'll dive into it.. Only a direction is most of the time enough to find more about the right commands...

Also I just noted a small glitch is in my current script: when buttons are switched, a right mouse click is performed (without user clicking),
I think some sort of "If mouse click then", needs to be inserted somewhere at lines 46, 52, 64 and 70... (to prevent the undersired clicking).. is there something like "if mousebutton is pressed"?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Pauze_interval := 900000 ; 15 min. 
Pauze_duur:= 20000 ; 20 sec.
switch_value := 0
cursor_right = D:\mouse\ARROW_GREEN_RIGHT.cur
cursor_left = D:\mouse\ARROW_RED_LEFT.cur


loop
{
	if switch_value = 0
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to RIGHT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_right) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}

	if switch_value = 1
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to LEFT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_left) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}
	switch_value := !switch_value
	Sleep, Pauze_interval
} 

; function_definitions:

button_toggle(togglevalue) {
	
	if (togglevalue = 1)
	{
		Hotkey,LButton,label1
		Hotkey,RButton,label2

		label1:
		Send % "{RButton down}"
		KeyWait, LButton
		Send, % "{RButton up}"
		return

		label2:
		Send % "{LButton down}"
		KeyWait, RButton
		Send, % "{LButton up}"
		return
	}

	if (togglevalue = 0)
	{
		Hotkey,LButton,label3
		Hotkey,RButton,label4

		label3:
		Send % "{LButton down}"
		KeyWait, LButton
		Send, % "{LButton up}"
		return

		label4:
		Send % "{RButton down}"
		KeyWait, RButton
		Send, % "{RButton up}"
		return
	}
}

SetSystemCursor(file)
{
	CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 	Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 	Loop, Parse, Cursors, `,
 	{
  		DllCall( "SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield )
 	}
}
User avatar
mikeyww
Posts: 26592
Joined: 09 Sep 2014, 18:38

Re: Mouse switch part 3

13 Nov 2020, 18:25

I have not tried this script, but if you want to determine whether a key or button is down or up, GetKeyState() can do it.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

18 Nov 2020, 08:32

mikeyww wrote:
13 Nov 2020, 18:25
I have not tried this script, but if you want to determine whether a key or button is down or up, GetKeyState() can do it.
Thanks again @mikeyww ,
I read the info and tried to work with it, but I couldn't work out a workable solution.
I tried using GetKeyState in a if, to prevent the execution of line

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Pauze_interval := 900000 ; 15 min. 
Pauze_duur:= 20000 ; 20 sec.
switch_value := 0
cursor_right = D:\mouse\ARROW_GREEN_RIGHT.cur
cursor_left = D:\mouse\ARROW_RED_LEFT.cur


loop
{
	if switch_value = 0
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to RIGHT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_right) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}

	if switch_value = 1
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to LEFT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_left) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}
	switch_value := !switch_value
	Sleep, Pauze_interval
} 

; function_definitions:

button_toggle(togglevalue) {
	
	if (togglevalue = 1)
	{
		Hotkey,LButton,label1
		Hotkey,RButton,label2

		label1:
		Send % "{RButton down}"
		KeyWait, LButton
		Send, % "{RButton up}"
		return

		label2:
		Send % "{LButton down}"
		KeyWait, RButton
		Send, % "{LButton up}"
		return
	}

	if (togglevalue = 0)
	{
		Hotkey,LButton,label3
		Hotkey,RButton,label4

		label3:
		Send % "{LButton down}"
		KeyWait, LButton
		Send, % "{LButton up}"
		return

		label4:
		Send % "{RButton down}"
		KeyWait, RButton
		Send, % "{RButton up}"
		return
	}
}

SetSystemCursor(file)
{
	CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 	Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 	Loop, Parse, Cursors, `,
 	{
  		DllCall( "SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield )
 	}
}

mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

18 Nov 2020, 08:36

mgroen wrote:
18 Nov 2020, 08:32
mikeyww wrote:
13 Nov 2020, 18:25
I have not tried this script, but if you want to determine whether a key or button is down or up, GetKeyState() can do it.
Thanks again @mikeyww ,
I read the info and tried to work with it, but I couldn't work out a workable solution.
I tried using GetKeyState in a if, to prevent the execution of lines 46, 52, 64 (this is what causes the clicks), but I can't get it to work.
Thing is you get stuck in loops.

I get the feeling that either autohotkey is not suitable for my "old school lineair programming style....

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Pauze_interval := 900000 ; 15 min. 
Pauze_duur:= 20000 ; 20 sec.
switch_value := 0
cursor_right = D:\mouse\ARROW_GREEN_RIGHT.cur
cursor_left = D:\mouse\ARROW_RED_LEFT.cur


loop
{
	if switch_value = 0
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to RIGHT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_right) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}

	if switch_value = 1
	{
		SplashTextOn, 300, 100, Mouse switch, switch mouse to LEFT hand
		Sleep, Pauze_duur
		SplashTextOff
		SetSystemCursor(cursor_left) ; Code voor muiscursor switch
		button_toggle(switch_value)
	}
	switch_value := !switch_value
	Sleep, Pauze_interval
} 

; function_definitions:

button_toggle(togglevalue) {
	
	if (togglevalue = 1)
	{
		Hotkey,LButton,label1
		Hotkey,RButton,label2

		label1:
		Send % "{RButton down}"
		KeyWait, LButton
		Send, % "{RButton up}"
		return

		label2:
		Send % "{LButton down}"
		KeyWait, RButton
		Send, % "{LButton up}"
		return
	}

	if (togglevalue = 0)
	{
		Hotkey,LButton,label3
		Hotkey,RButton,label4

		label3:
		Send % "{LButton down}"
		KeyWait, LButton
		Send, % "{LButton up}"
		return

		label4:
		Send % "{RButton down}"
		KeyWait, RButton
		Send, % "{RButton up}"
		return
	}
}

SetSystemCursor(file)
{
	CursorHandle := DllCall("LoadCursorFromFile", Str, file)
 	Cursors = 32512,32513,32514,32515,32516,32640,32641,32642,32643,32644,32645,32646,32648,32649,32650,32651
 	Loop, Parse, Cursors, `,
 	{
  		DllCall( "SetSystemCursor", Uint, CursorHandle, Int, A_Loopfield )
 	}
}

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

Re: Mouse switch part 3

18 Nov 2020, 09:16

mgroen wrote:
18 Nov 2020, 08:36
I get the feeling that either autohotkey is not suitable for my "old school lineair programming style....
It’s not AutoHotkey that is not suitable to a linear programming style. It’s the task at hand that requires you to think in an event-driven programming style, no matter what language is used.
mgroen
Posts: 97
Joined: 13 Jul 2018, 02:22

Re: Mouse switch part 3

18 Nov 2020, 15:42

boiler wrote:
18 Nov 2020, 09:16
mgroen wrote:
18 Nov 2020, 08:36
I get the feeling that either autohotkey is not suitable for my "old school lineair programming style....
It’s not AutoHotkey that is not suitable to a linear programming style. It’s the task at hand that requires you to think in an event-driven programming style, no matter what language is used.
OK, @boiler do you recommend any specific book/ literature for me to read about event-driving programming? to learn about it...
User avatar
boiler
Posts: 16767
Joined: 21 Dec 2014, 02:44

Re: Mouse switch part 3

18 Nov 2020, 15:50

I recommend the AutoHotkey documentation. It has many examples including the script showcase. I learned only from that, not from any outside books. If you prefer books, you might want to check out Jack Dunning's books. I haven't read them, but I've seen others say good things about them.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: garry, jaka1, marypoppins_1, mikeyww, OrangeCat, RussF and 141 guests