Only If LButton is Clicked do...

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sylvester
Posts: 2
Joined: 28 May 2017, 19:03

Only If LButton is Clicked do...

28 May 2017, 19:16

I am trying to write an hotkey like this:

if you press F1 then at the next Left Mouse Click you will save a screengrab.

I came up with this:

Code: Select all

Stop := 0
EE := 0



F1::
{
	SendMode Input

	~LButton::

	{
		send #{PRINTSCREEN}

		FormatTime, TimeString, , dd'-'MMM'_'hh'-'mm'_s'ss

		Sleep, 800

		FileMove, C:\Users\sergioMacUser\Pictures\Screenshots\*.png, C:\Users\sergioMacUser\Pictures\%TimeString%_Trade-%Stop%.png

		Sleep, 50

		FileDelete, C:\Users\sergioMacUser\Pictures\Screenshots\*.png

		if (EE = 1) {
			Stop := Stop + 1
			EE := 0
		}

		else if (EE = 0) {
			EE := 1
		}


	}
	Return
}

Return
(it does also label every other screengrab with a different number)

At the moment it works but it makes screenshots also when I press F1, instead it should only do screengrab when the left mouse button is pressed. F1 is only like the activation of the gun but the trigger is only LButton.

I should also add that pressing F2 deactivates the trigger.
Once LButton is clicked once it shoud deactivate too. So to make another screengrab you have to press F1 again.

Any help to fix my issue?

Thanks!
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Only If LButton is Clicked do...

28 May 2017, 19:45

I'm not at home but if you haven't gotten help by the time I get home I'll help you
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Only If LButton is Clicked do...

28 May 2017, 22:32

Code: Select all

f1::
	active := 1
return

f2::
	active := 0
return

#if active 
~Lbutton::
	send #{PRINTSCREEN}
	FormatTime, TimeString, , dd'-'MMM'_'hh'-'mm'_s'ss
	Sleep, 800
	FileMove, C:\Users\sergioMacUser\Pictures\Screenshots\*.png, C:\Users\sergioMacUser\Pictures\%TimeString%_Trade-%Stop%.png
	Sleep, 50
	FileDelete, C:\Users\sergioMacUser\Pictures\Screenshots\*.png
	if (EE = 1) 	
		{
			Stop := Stop + 1
			EE := 0
		}

		else if (EE = 0) 
		{
			EE := 1
		}
return
sylvester
Posts: 2
Joined: 28 May 2017, 19:03

Re: Only If LButton is Clicked do...

29 May 2017, 04:47

brilliant thanks.

can I ask you what the '#' sign in front of 'if' is for?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot] and 400 guests