need help toggling action, not keypress.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chrisB114
Posts: 3
Joined: 22 Mar 2018, 18:00

need help toggling action, not keypress.

22 Mar 2018, 18:08

okay, this is the code. I want the right mouse button to toggle the script action off and on, but not for the right mouse button to the toggled.
Spoiler
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: need help toggling action, not keypress.

23 Mar 2018, 01:45

Hallo,
you do not want an RClick? Remove the tilde "~".
chrisB114
Posts: 3
Joined: 22 Mar 2018, 18:00

Re: need help toggling action, not keypress.

23 Mar 2018, 12:42

evilC wrote:What in god's name is that code?
It adds a new Gui item each time you click ?!?!?
lol yes, that's what it does. I want to have a Dot in the center of my screen, then make it go away when I press Rbutton then come back when I press Rbutton again. But idk how to make it so the Rbutton still works and is not always down when dot is onscreen. But right now when the dot is on the keyboard press's will not work because the Rbutton stays toggled down.
Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: need help toggling action, not keypress.

24 Mar 2018, 03:17

Hallo,
The KeyState of RButton switches up and down!
Try:

Code: Select all

Loop
{
	ToolTip, % GetKeyState("RButton")?"Down":"Up"
	Sleep, 300
}
*~RButton::
Toggle := !Toggle
  If toggle
{
diam = 5	; diameter of dot
Gui +AlwaysOnTop -Caption +ToolWindow
Gui margin,0,0
Gui add, ListView,	w%diam% h%diam%	-Hdr -E0x200 BackgroundWhite
SysGet, mon, MonitorWorkArea		; get screen size (to include taskbar height delete text 'WorkArea')
Gui show, % "x" monRight//2-(diam//2) " y" monBottom//2-(diam//2)
WinSet, Region, 0-0 W%diam% H%diam% E, A		; make it circular
return
}

  else
 Gui, destroy
chrisB114
Posts: 3
Joined: 22 Mar 2018, 18:00

Re: need help toggling action, not keypress.

24 Mar 2018, 19:34

Rohwedder wrote:Hallo,
The KeyState of RButton switches up and down!
Try:

Code: Select all

Loop
{
	ToolTip, % GetKeyState("RButton")?"Down":"Up"
	Sleep, 300
}
*~RButton::
Toggle := !Toggle
  If toggle
{
diam = 5	; diameter of dot
Gui +AlwaysOnTop -Caption +ToolWindow
Gui margin,0,0
Gui add, ListView,	w%diam% h%diam%	-Hdr -E0x200 BackgroundWhite
SysGet, mon, MonitorWorkArea		; get screen size (to include taskbar height delete text 'WorkArea')
Gui show, % "x" monRight//2-(diam//2) " y" monBottom//2-(diam//2)
WinSet, Region, 0-0 W%diam% H%diam% E, A		; make it circular
return
}

  else
 Gui, destroy
I got it to work with most everything thanks, guys!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5 and 197 guests