|
You last visited: Today at 23:40
Advertisement
Help over Window Focus!
Discussion on Help over Window Focus! within the AutoIt forum part of the Coders Den category.
06/22/2014, 13:07
|
#1
|
elite*gold: 0
Join Date: Jan 2014
Posts: 54
Received Thanks: 26
|
Help over Window Focus!
I want to make an bot for all resolutions for League of Legends, but, i don't know how to make WindowFocus (my point: switches to that window - if active), here is my code so far:
Quote:
Global $resolution
; ------------------------------------------------------------------------------
MsgBox(0, "Desktop Resolution", _Desktop_Resolution() & " @ " & @DesktopRefresh & " Hertz")
Func _Desktop_Resolution()
Switch $resolution = ""
Case @DesktopWidth = 640 And @DesktopHeight = 480; Video Graphics Array
Case @DesktopWidth = 800 And @DesktopHeight = 480; Wide Video Graphics Array
Case @DesktopWidth = 854 And @DesktopHeight = 480; Full Wide Video Graphics Array
Case @DesktopWidth = 800 And @DesktopHeight = 600; Super Video Graphics Array
Case @DesktopWidth = 960 And @DesktopHeight = 540; Quarter Full HD
Case @DesktopWidth = 1024 And @DesktopHeight = 576; Wide Super Video Graphics Array
Case @DesktopWidth = 1024 And @DesktopHeight = 600; Wide Super Video Graphics Array
Case @DesktopWidth = 1024 And @DesktopHeight = 768; eXtended Graphics Array
Case @DesktopWidth = 1152 And @DesktopHeight = 864; eXtended Graphics Array Plus
Case @DesktopWidth = 1280 And @DesktopHeight = 720; Wide eXtended Graphics Array
Case @DesktopWidth = 1280 And @DesktopHeight = 768; Wide eXtended Graphics Array
Case @DesktopWidth = 1280 And @DesktopHeight = 800; Wide eXtended Graphics Array
Case @DesktopWidth = 1280 And @DesktopHeight = 960; Super eXtended Graphics Array
Case @DesktopWidth = 1280 And @DesktopHeight = 1024; Super eXtended Graphics Array
Case @DesktopWidth = 1360 And @DesktopHeight = 768; Wide eXtended Graphics Array
Case @DesktopWidth = 1366 And @DesktopHeight = 768; High Definition (720p)
Case @DesktopWidth = 1440 And @DesktopHeight = 900; Wide Super eXtended Graphics Array
Case @DesktopWidth = 1400 And @DesktopHeight = 1050; Wide Super eXtended Graphics Array
Case @DesktopWidth = 1600 And @DesktopHeight = 900; High Definition Plus (900p
Case @DesktopWidth = 1600 And @DesktopHeight = 1200; Ultra eXtended Graphics Array
Case @DesktopWidth = 1680 And @DesktopHeight = 1050; Wide Super eXtended Graphics Array Plus
Case @DesktopWidth = 1920 And @DesktopHeight = 1080; Full High Definition (1080p)
ControlFocus("[CLASS:PVP.net Client]", "", "");
MouseClick("left", 1413, 890, 1620)
EndSwitch
EndFunc
|
Results: It didn't worked(i'm testing at 1920x1080 case, since that's my resolution)
|
|
|
06/22/2014, 16:20
|
#2
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
I think you got the Switch-Case Statement wrong. Case accepts values for example
Code:
Switch 5
Case 5
;....
You want to use Select I think
Code:
Select
Case @DesktopWidth = 640 And ....
|
|
|
06/22/2014, 20:13
|
#3
|
elite*gold: 0
Join Date: Jan 2014
Posts: 54
Received Thanks: 26
|
No, i wan't to Window Focus (click on League of Legends launcher in taskbar or similar)
|
|
|
06/22/2014, 20:37
|
#4
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
Then you're probably looking for WinActivate() although your switch statement looks weird to me.
|
|
|
06/22/2014, 21:29
|
#5
|
elite*gold: 0
Join Date: Jan 2014
Posts: 54
Received Thanks: 26
|
Yeah, can you please tell me how it works and how do i make it to switch to League of Legends?
-Don't mind the switch statement, it's perfect for me.
|
|
|
06/23/2014, 14:18
|
#6
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
Code:
WinActivate("window title")
window title is your client title.
You can find it via AutoIt Window Info or by holding the mouse over the icon in the taskbar.
|
|
|
06/23/2014, 17:50
|
#7
|
elite*gold: 0
Join Date: Jan 2014
Posts: 54
Received Thanks: 26
|
One more question sir, i cound't find it on google, here it is: The Script: WinActivate("PVP.net Client")
MouseClick("left", 1413, 890, 1620)
MouseClick("left", 1402, 365, 1620)
MouseClick("left", 1402, 365, 1620)
MouseClick("left", 473, 846, 1620)
Works fine and the cases too, but, it doesen't stops clicking, it just shows LoL launcher and don't clicks and continues as it should, the mouse just simply clicks where you put it!
|
|
|
06/23/2014, 17:54
|
#8
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
If you'd post more of the script we can identify the problem. Here is no loop so it shouldn't click non-stop.
|
|
|
06/23/2014, 18:00
|
#9
|
elite*gold: 0
Join Date: Jan 2014
Posts: 54
Received Thanks: 26
|
WinActivate("PVP.net Client")
MouseClick("left", 1413, 890, 1620)
MouseClick("left", 1402, 365, 1620)
MouseClick("left", 1402, 365, 1620)
MouseClick("left", 473, 846, 1620)
This is the script, the mouse just keeps clicking, but, not where it should, should i make video?
|
|
|
06/23/2014, 18:08
|
#10
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
Are you sure your coordinates and the amount of clicks are right?
Because 1620 clicks seems a bit unusual to me.
Here's the page to the documentation of MouseClick, maybe it'll help you
|
|
|
06/23/2014, 18:12
|
#11
|
elite*gold: 0
Join Date: Jan 2014
Posts: 54
Received Thanks: 26
|
Thanks bro, the number of clicks was wrong, i tought 1620 was the delay one!
|
|
|
06/23/2014, 18:50
|
#12
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
If that's so it's still wrong because the delay goes from 0 (instant) to 100 (slowest).
|
|
|
06/23/2014, 20:09
|
#13
|
elite*gold: 15
Join Date: Aug 2012
Posts: 3,041
Received Thanks: 6,394
|
I don't really understand how does he want to delay it but you can use Sleep(1620) in between the clicks I think.
|
|
|
All times are GMT +2. The time now is 23:40.
|
|