[Help] Autoit - Detect Screen resolution

10/22/2012 11:21 ladygrace3#1
Hi everyone.

I Have made a gear swapper for Diablo 3. Me and my friend bot use it but i am wanting to know what to change/ understand how to make it detect the screen size so i dont have to mod it everytime i change things in it.

I am still very new to using Autoit :)


Code:
#RequireAdmin
#region --- CodeWizard generated code Start ---
#endregion --- CodeWizard generated code Start ---
Global $Paused
Global $count = 0
HotKeySet("{F1}", "CE")
While 1
	Sleep(5)
WEnd
Func CE()
	If $count < 1 Then
		ControlSend("Diablo III", "", "", "{SPACE}"); Hotkey
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		MouseMove(1835, 475, 0)
		MouseDown("Left")
		MouseMove(1775, 825, 0)
		MouseUp("Left")
		MouseClick("Right", 1825, 825, 1, 0)
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		MouseMove(962, 450, 0)
		Global $count = 1
	ElseIf $count >= 1 Then
		ControlSend("Diablo III", "", "", "{SPACE}"); Hotkey
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		ControlClick("Diablo III", "", "", "Right", 1, 1825, 825) ;Weapon
		ControlClick("Diablo III", "", "", "Right", 1, 1775, 825) ;Shield
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		Global $count = 0
	EndIf
EndFunc   ;==>CE
Thanks in advance
10/22/2012 12:23 H@CT0R#2
@desktopheight
@desktopwidth

;)
10/22/2012 13:12 ladygrace3#3
Quote:
Originally Posted by H@CT0R View Post
@desktopheight
@desktopwidth

;)
Would i have to insert anything into where the pixels should be clicked? as the ones i have in are for a bigger monitor?
10/22/2012 14:09 Lawliet#4
Yes. You should use dinamic Values like @desktopwidth / x.
@desktopheoght (1280px) / 0,701369863 would be 1825
10/23/2012 05:19 ladygrace3#5
Quote:
Originally Posted by Lawliet! View Post
Yes. You should use dinamic Values like @desktopwidth / x.
@desktopheoght (1280px) / 0,701369863 would be 1825
Sorry i suck at learning lol
I am still having trouble understanding, so are you able to insert it into my code so i can see exactly how it is done as it will help me understand :)

Thanks
10/23/2012 19:34 Jonas_93#6
princip of dynamic values in context to screens:

These values change in depence of your screen-size.
You declare a percentage/fraction of a screen, so everyone can use it, with every screenresolution.

For Example you have a Screenwidth of 2000px and want to click at 1500.
Declare this Coordination with a percentage to your screen => 3/4*ScreenWidth and not the static value 1500.
So somebody else with the screen width 1000 also clicks at the same Koordinate like you => 750px; 3/4 of 1000.

I dont know your screen resolution so we can't finish your code, or insert dynamic values.

Another idea would be to easy the way geting the coordinations. For example take transparent guis, which can be moved and resized, to easy restrict the area a click can be set.

Jonas93
10/24/2012 01:00 ladygrace3#7
Quote:
Originally Posted by Jonas_93 View Post
princip of dynamic values in context to screens:

These values change in depence of your screen-size.
You declare a percentage/fraction of a screen, so everyone can use it, with every screenresolution.

For Example you have a Screenwidth of 2000px and want to click at 1500.
Declare this Coordination with a percentage to your screen => 3/4*ScreenWidth and not the static value 1500.
So somebody else with the screen width 1000 also clicks at the same Koordinate like you => 750px; 3/4 of 1000.

I dont know your screen resolution so we can't finish your code, or insert dynamic values.

Another idea would be to easy the way geting the coordinations. For example take transparent guis, which can be moved and resized, to easy restrict the area a click can be set.

Jonas93
Sorry my screen res is 1900,1080
10/24/2012 08:49 Jonas_93#8
Code:
#RequireAdmin
#region --- CodeWizard generated code Start ---
#endregion --- CodeWizard generated code Start ---
Global $Paused
Global $count = 0
Global $sHeight = @DesktopHeight
Global $sWidht = @DesktopWidth
HotKeySet("{F1}", "CE")
While 1
	Sleep(5)
WEnd
Func CE()
	If $count < 1 Then
		ControlSend("Diablo III", "", "", "{SPACE}"); Hotkey
		ControlSend("Diablo III", "", "", "{I}"); Inventory


;;;;;;;;;EXAMPLE;;;;;;;;;;;;;		
MouseMove(($sWidth * 0,965789473684),($sHeight*0,439814814815), 0)
;;;;;;;;;EXAMPLE;;;;;;;;;;;;;		


                MouseDown("Left")
		MouseMove(1775, 825, 0)
		MouseUp("Left")
		MouseClick("Right", 1825, 825, 1, 0)
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		MouseMove(962, 450, 0)
		Global $count = 1
	ElseIf $count >= 1 Then
		ControlSend("Diablo III", "", "", "{SPACE}"); Hotkey
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		ControlClick("Diablo III", "", "", "Right", 1, 1825, 825) ;Weapon
		ControlClick("Diablo III", "", "", "Right", 1, 1775, 825) ;Shield
		ControlSend("Diablo III", "", "", "{I}"); Inventory
		Global $count = 0
	EndIf
EndFunc   ;==>CE
Get these values by dividing your resolution with the coordinates.