demandnothing Posted September 6, 2009 Share Posted September 6, 2009 i have a script that bases the PixelSearch() box around the center of your screen, using @DesktopWidth and @DesktopHeight. when i run the program i want to use this sort of script on, it seems that the program changes your desktop resolution in order for it to run in whatever resolution it uses.. is there any way i can use an HWid command to base the coordinates off of? Link to comment Share on other sites More sharing options...
Inverted Posted September 7, 2009 Share Posted September 7, 2009 I don't get it. Why don't you get the desktop resolution after the program has changed it ? So then you can find the center. Link to comment Share on other sites More sharing options...
demandnothing Posted September 7, 2009 Author Share Posted September 7, 2009 well i've tried that and it doesnt seem to work.. the desktop resolution to the script comes as what your computer is set up to, not what the program has changed it to. Link to comment Share on other sites More sharing options...
Inverted Posted September 7, 2009 Share Posted September 7, 2009 (edited) So, you don't need the desktop resolution, you need the current resolution. I think you should use a nice DllCall to GetSystemMetrics. Example thread : http://www.autoitscript.com/forum/index.php?showtopic=97151 Except you want another piece of info, not $SM_VIRTUALWIDTH. I'm not sure which, there's so many : http://msdn.microsoft.com/en-us/library/ms724385%28VS.85%29.aspx EDIT: Also do a forum search for "resolution", only on thread titles. Edited September 7, 2009 by Inverted Link to comment Share on other sites More sharing options...
demandnothing Posted September 7, 2009 Author Share Posted September 7, 2009 well that looks great.. but how would i use the GetSystemMetric SM_CXEDGE and SM_CYEDGE in autoit? or how would i convert those two properties into the example script? Global Const $SM_VIRTUALWIDTH = 78 Global Const $SM_VIRTUALHEIGHT = 79 $VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH) $VirtualDesktopWidth = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $VirtualDesktopHeight = $VirtualDesktopHeight[0] ??? Link to comment Share on other sites More sharing options...
Inverted Posted September 7, 2009 Share Posted September 7, 2009 (edited) I tested your script and it works fine. Global Const $SM_VIRTUALWIDTH = 78 Global Const $SM_VIRTUALHEIGHT = 79 Sleep (10000) $VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH) $VirtualDesktopWidth = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $VirtualDesktopHeight = $VirtualDesktopHeight[0] MsgBox (4096, "", $VirtualDesktopWidth &" "& $VirtualDesktopHeight) I put a sleep there for 10 seconds, ran the script, then ran a game at a resolution different than my desktop and it returned the correct resolution. So, that's it I guess ! Edited September 7, 2009 by Inverted Link to comment Share on other sites More sharing options...
demandnothing Posted September 7, 2009 Author Share Posted September 7, 2009 thanks a lot for your help.. how do i make sure you are acknowledged for this? Link to comment Share on other sites More sharing options...
Inverted Posted September 7, 2009 Share Posted September 7, 2009 Sacrifice a goat in my name ! Link to comment Share on other sites More sharing options...
demandnothing Posted September 8, 2009 Author Share Posted September 8, 2009 done and done.. do you think you can help me with another problem? i posted a thread asking for help but the responses are coming very slowly.. how would i declare a variable as a moving object? floating variable type somebody said.. i dont really know.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now