when click left mouse then auto typing something in the box

Ask gaming related questions (AHK v1.1 and older)
maload
Posts: 40
Joined: 05 Mar 2017, 22:13

when click left mouse then auto typing something in the box

Post by maload » 28 Jan 2022, 11:58

such as when i click in the box then it will auto type " fffff " or something like 9999 in the box .

i have read and copy this code but it work sometime

i test in notepad and firefox.
sometime its work like crazy but sometime its do nothing .

https://www.autohotkey.com/board/topic/50345-mouse-button-send-q-and-send-mouse-button-same-time/

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

Re: when click left mouse then auto typing something in the box

Post by mikeyww » 28 Jan 2022, 19:29

For a desktop program, you could define a hotkey for ~LButton that checks to see if the current control is an edit control. If it is, then you can issue a Send command.

maload
Posts: 40
Joined: 05 Mar 2017, 22:13

Re: when click left mouse then auto typing something in the box

Post by maload » 29 Jan 2022, 02:16

thank you so mcuh

maload
Posts: 40
Joined: 05 Mar 2017, 22:13

Re: when click left mouse then auto typing something in the box

Post by maload » 29 Jan 2022, 02:20

i rewrite macro and i want to do the same thing " click and just type 9999 "

this is it and its new question here


==========================================================

Code: Select all

lbutton::
click
sendinput  {9 down} 
sendinput  {9   up  }
sendinput  {9 down} 
sendinput  {9   up  }
sendinput  {9 down} 
sendinput  {9   up  }
sendinput  {9 down} 
sendinput  {9   up  }
return

;i do what i want to   ( click and just tying )

Esc::
ExitApp

;here is the problem


f1::suspend ; i guess this will  stop macro for awhile
f10::reload  ;  so i think this key will let macro  run again  but it dont do it ( i need to right click  and choose " reload this script")
[Mod edit: [code][/code] tags added.]

I do this because i want to stop script for awhile when i dont know how to let it run " only in game "

so what should i write when i need autohotkey for stop but not dead and it can reload

another question

this is information that i have spy with autohotkey

=====================================================
Planet Coaster
ahk_class FrontierDevelopmentsAppWinClass
ahk_exe PlanetCoaster.exe
ahk_pid 1156
=======================================================

i have read some information on the net so i put this line

if WinActive("ahk_class FrontierDevelopmentsAppWinClass")

but the autohotkey run everywhere ...

how to write proper script ?

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

Re: when click left mouse then auto typing something in the box

Post by boiler » 29 Jan 2022, 07:01

For your second question, you need to use a directive to make a hotkey conditional, not a regular if statement:

Code: Select all

#If WinActive("ahk_class FrontierDevelopmentsAppWinClass")

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

Re: when click left mouse then auto typing something in the box

Post by mikeyww » 29 Jan 2022, 07:04

Yes, and that will mostly answer the first question, too, because the hotkey would work only in the context that boiler defined. F1 will suspend the hotkey, which means that pressing the hotkey again will have no effect. Once the SendInput occurs, you would have trouble stopping it with Pause because it is so fast.

Code: Select all

class = FrontierDevelopmentsAppWinClass
F1::Suspend
#If WinActive("ahk_class " class)
~LButton Up::SendInput 9999 ; Can remove "Up" if needed
#If

maload
Posts: 40
Joined: 05 Mar 2017, 22:13

Re: when click left mouse then auto typing something in the box

Post by maload » 29 Jan 2022, 10:00

thank you so much friend for helping and guiding.
i

Post Reply

Return to “Gaming Help (v1)”