Script Help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chris114
Posts: 8
Joined: 20 Oct 2013, 14:36

Script Help

26 Aug 2017, 15:55

Ok so I made this script the one in the spoiler, what I want it to do is when I hold down the Right mouse button For 1 second I want it to press 8 key that activates the 8 keys toggle. but when the script presses the 8 the toggle doesn't activate, any help would be great.
Spoiler
Rindis
Posts: 213
Joined: 23 Dec 2013, 13:58
Location: Norway
Contact:

Re: Script Help

27 Aug 2017, 01:58

try to add

Code: Select all

Critical Off 
at the top of script

it works (I think) for this

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.


Critical Off 

#MaxThreadsPerHotkey 10
CoordMode, Pixel, Window

~$RButton::
 KeyWait RButton, T1.0
  While GetKeyState("RButton", "P") = 1
{
    send,{8 down}
	;~ sleep, 10
}
 GetKeyState("RButton", "P") = 0
    send, {8 up}

return

f1::
Toggle := !Toggle
  If toggle
	Msgbox  her
	/*
{
 Gui, +AlwaysOnTop -Caption
 Gui, Add, Text,, Toggle is ON 
 Gui, Show, NoActivate w75 h27 x940 y0, toggle is ON
}
  else
 Gui, destroy

  While Toggle{  	
 PixelSearch, FoundX, FoundY, 901, 537, 1020, 590, 0xD0150C, 0, Fast RGB
  If ErrorLevel = 0
{
    Send, {j down}
  sleep 300
    Send, {j up}
}
 }
    */
return

chris114
Posts: 8
Joined: 20 Oct 2013, 14:36

Re: Script Help

27 Aug 2017, 11:41

Thank you but I got it lol I removed

Code: Select all

~$RButton::
 KeyWait RButton, T1.0
  While GetKeyState("RButton", "P") = 1
{
    send,{8 down}
	 sleep, 10
}
 GetKeyState("RButton", "P") = 0
    send, {8 up}
	
return
and just made this

Code: Select all

Critical Off 
#MaxThreadsPerHotkey 10
CoordMode, Pixel, Window


~$RButton::
 KeyWait RButton, T1.0
  While GetKeyState("RButton", "P")
Toggle := !Toggle
  If toggle
{
 Gui, +AlwaysOnTop -Caption +ToolWindow
 Gui, Add, Text,, Toggle is ON 
 Gui, Show, NoActivate w75 h27 x940 y0, toggle is ON
}
  else
 Gui, destroy

  While Toggle{  	
PixelSearch, FoundX, FoundY, 920, 510, 997, 572, 0xD0140B, 0, Fast RGB
  If ErrorLevel = 0
{
    Send, {j down}
  sleep 300
    Send, {j up}
}
 }
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, Bing [Bot], Google [Bot] and 145 guests