Help over Window Focus!

06/22/2014 13:07 TheAnonPanda#1
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 alpines#2
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 TheAnonPanda#3
No, i wan't to Window Focus (click on League of Legends launcher in taskbar or similar)
06/22/2014 20:37 alpines#4
Then you're probably looking for WinActivate() although your switch statement looks weird to me.
06/22/2014 21:29 TheAnonPanda#5
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 alpines#6
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 TheAnonPanda#7
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 alpines#8
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 TheAnonPanda#9
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 alpines#10
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
[Only registered and activated users can see links. Click Here To Register...]
06/23/2014 18:12 TheAnonPanda#11
Thanks bro, the number of clicks was wrong, i tought 1620 was the delay one!
06/23/2014 18:50 alpines#12
If that's so it's still wrong because the delay goes from 0 (instant) to 100 (slowest).
06/23/2014 20:09 berkay2578#13
I don't really understand how does he want to delay it but you can use Sleep(1620) in between the clicks I think.