firefox click - background

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Makaronik
Posts: 4
Joined: 17 Mar 2019, 11:52

firefox click - background

17 Mar 2019, 12:02

Hello, I tried to create background script in ahk but it doesn't work ;v any suggest why it's not working?
I will be grateful if you help me :)

Code: Select all

ControlClick, x642 y142, Firefox
	sleep, 5000
ControlClick, x424 y169, Firefox
	sleep, 35000
ControlClick, x956 y207, Firefox
	sleep, 1500
ControlClick, x164 y711, Firefox
	sleep, 1500
ControlClick, x1272 y90, Firefox
	sleep, 1000
ControlClick, x1271 y90, Firefox
	sleep, 1500
ControlClick, x334 y20, Firefox
	sleep, 1000
ControlClick, x824 y362, Firefox
	sleep, 1000
ControlClick, x828 y582, Firefox
	sleep, 1000
ControlClick, x828 y582, Firefox
	sleep, 1000
ControlClick, x597 y441, Firefox
	sleep, 1000
ControlClick, x597 y441, Firefox
	sleep, 1000
ControlClick, x157 y18, Firefox
	sleep, 1000
ControlClick, x88 y50, Firefox
	sleep, 9000
ControlClick, x90 y55, Firefox
	sleep, 17000
ControlClick, x862 y757, Firefox
	sleep, 1500
ControlClick, x791 y588, Firefox
	sleep, 1000
ControlClick, x797 y286, Firefox
	sleep 1200
Send {o}, Firefox
	sleep, 100
Send {p}, Firefox
	sleep, 100
Send {o}, Firefox
	sleep, 100
Send {p}, Firefox
	sleep, 100
Send {o}, Firefox
	sleep, 100
Send {i}, Firefox
	sleep, 7000
Send {tab}, Firefox
	sleep, 1000
Send {1}, Firefox
	sleep, 100
Send {1}, Firefox
	sleep, 100
Send {1}, Firefox
	sleep, 100
Send {1}, Firefox
	sleep, 100
Send {2}, Firefox
	sleep, 100
Send {1}, Firefox
	sleep, 100
Send {2}, Firefox
	sleep, 100
Send {3}, Firefox
	sleep, 3000
ControlClick, x925 y687, Firefox
	sleep, 5000
ControlClick, x372 y465, Firefox
	sleep, 2000
ControlClick, x839 y469, Firefox
	sleep, 1000
ControlClick, x194 y246, Firefox
	sleep, 30000
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: firefox click - background

17 Mar 2019, 12:28

Hi,
1. Replace Firefox by ahk_class MozillaWindowClass
2. Check if the coordinates are really correct
3. Replace Send by ControlSend

Example:

Code: Select all

ControlClick, x797 y286, ahk_class MozillaWindowClass
Sleep, 1200
ControlSend, {o}, ahk_class MozillaWindowClass
Also, you don't need so many lines.
You can send the keys with 1 ControlSend.

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
Makaronik
Posts: 4
Joined: 17 Mar 2019, 11:52

Re: firefox click - background

17 Mar 2019, 13:03

Scr1pter wrote:
17 Mar 2019, 12:28
Hi,
1. Replace Firefox by ahk_class MozillaWindowClass
2. Check if the coordinates are really correct
3. Replace Send by ControlSend

Example:

Code: Select all

ControlClick, x797 y286, ahk_class MozillaWindowClass
Sleep, 1200
ControlSend, {o}, ahk_class MozillaWindowClass
Also, you don't need so many lines.
You can send the keys with 1 ControlSend.

Cheers!
Thanks but coordinates are correct and still not clicking on site. Script work when i want to change a card in a firefox but still not clicking on the site. If i want click submit when i reply post, script doesnt click and i have to do it manually. ;-;
Makaronik
Posts: 4
Joined: 17 Mar 2019, 11:52

Re: firefox click - background

17 Mar 2019, 13:15

Thanks, but coordinates are correct and script still not clicking on site. Script work when I want to change a card in a firefox but still not clicking on the site. If I want click submit when I reply post, script doesnt click. ;x
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: firefox click - background

17 Mar 2019, 13:28

Can you explain what exactly you're trying to do?
Also, why those extremely long sleeping times?
Do you want to let the script wait until a site has been loaded?

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
Makaronik
Posts: 4
Joined: 17 Mar 2019, 11:52

Re: firefox click - background

17 Mar 2019, 14:03

I need script to use like bot in game :p
bot have to load site, refresh, login and click in game but hes not clicking
ControlClick, x642 y142, ahk_class MozillaWindowClass - will not click menu in browser game but when want to change cards in firefox he will do it. So... I dont understand why :D

Code: Select all

ControlClick, x642 y142, ahk_class MozillaWindowClass
sleep, 5000
ControlClick, x434 y171, ahk_class MozillaWindowClass
sleep, 35000
ControlClick, x956 y213, ahk_class MozillaWindowClass
sleep, 1500
ControlClick, x128 y706, ahk_class MozillaWindowClass
sleep, 1500
ControlClick, x1272 y90, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x1271 y90, ahk_class MozillaWindowClass
sleep, 1500
ControlClick, x334 y20, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x824 y362, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x828 y582, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x828 y582, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x597 y441, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x597 y441, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x157 y18, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x88 y50, ahk_class MozillaWindowClass
sleep, 9000
ControlClick, x90 y55, ahk_class MozillaWindowClass
sleep, 17000
ControlClick, x862 y757, ahk_class MozillaWindowClass
sleep, 1500
ControlClick, x791 y588, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x797 y286, ahk_class MozillaWindowClass
sleep 1200
Send {l}, ahk_class MozillaWindowClass
sleep, 100
Send {o}, ahk_class MozillaWindowClass
sleep, 100
Send {g}, ahk_class MozillaWindowClass
sleep, 100
Send {i}, ahk_class MozillaWindowClass
sleep, 100
Send {n}, ahk_class MozillaWindowClass
sleep, 100
Send {1}, ahk_class MozillaWindowClass
sleep, 7000
Send {tab}, ahk_class MozillaWindowClass
sleep, 1000
Send {p}, ahk_class MozillaWindowClass
sleep, 100
Send {a}, ahk_class MozillaWindowClass
sleep, 100
Send {s}, ahk_class MozillaWindowClass
sleep, 100
Send {s}, ahk_class MozillaWindowClass
sleep, 100
Send {w}, ahk_class MozillaWindowClass
sleep, 100
Send {o}, ahk_class MozillaWindowClass
sleep, 100
Send {r}, ahk_class MozillaWindowClass
sleep, 100
Send {d}, ahk_class MozillaWindowClass
sleep, 3000
ControlClick, x925 y687, ahk_class MozillaWindowClass
sleep, 5000
ControlClick, x372 y465, ahk_class MozillaWindowClass
sleep, 2000
ControlClick, x839 y469, ahk_class MozillaWindowClass
sleep, 1000
ControlClick, x194 y246, ahk_class MozillaWindowClass
sleep, 30000
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: firefox click - background

24 Mar 2019, 09:01

There are a number of ways to automate Firefox.

1. You can play with browser windows, as if non-standard windows.

Code: Select all

Run, firefox.exe
WinWait, ahk_exe firefox.exe
If WinExist("ahk_exe firefox.exe") 
{
	WinActivate, ahk_exe firefox.exe
	SendInput {whatever key}
}
2. Use browser shortcut keys. Link to lots of them- https://shortcutworld.com/Firefox/win/Firefox_Shortcuts

Code: Select all

WinGetTitle, TabTitle, A  ; can be used to get tab (window) title info
If !InStr(TabTitle, "New Tab")
{			
	SendInput ^t  ; will create a new tab
}
3. You can also use PixelSearch (PixelSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ColorID [, Variation, Fast|RGB])

If there is a particular color on the screen that you want to click, you can put in the coordinates for the top left and bottom right area of where the color can be found. When the color is found, PixelSearch will put the coordinate into the OutputVarX, OutputVarY. Then you can use ControlClick or MouseClick to click that coordinate.
Example:

Code: Select all

PixelSearch, OutputVarX, OutputVarY, 50, 75, 200, 747, 0x332144, 10, Fast
if ErrorLevel
{
	Hit := "No"
}
if !ErrorLevel
{
	Hit := "Yes"
	MouseClick, left, %OutputVarX%, %OutputVarY%, 1
}
There are even more advanced ways of automating Firefox, but usually find that the basics and going through the UI works quite well, once you figured some tricks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mcd and 287 guests