iRAWRRichard Posted December 27, 2011 Share Posted December 27, 2011 Pretty much what the title says. I'm not looking to change a desktop resolution, but simply coming up with a single coordinate that would work for every desktop resolution. An example would be that I'm looking to opening a file on a 1024x768 resolution. I know I could simple record a coordinate for that file, but then that same coordinate wouldn't work for another resolution such as 1440x900. Some solutions I found was to use @DesktopHeight/Width and divide it by some number. I would do this, but I'm not sure what the number would be. Is there any other methods I could use? Thanks for any help! :] Link to comment Share on other sites More sharing options...
Robjong Posted December 27, 2011 Share Posted December 27, 2011 (edited) Hi, Please provide some more information about how you are going to use this.... Is it to center a GUI for example? Local $hGUI = GUICreate('', 400, 300, -1, -1) ; centered GUI of 400x300 GUISetState() WinMove($hGUI, "", 10, 10) ; move window off center... Sleep(1000) ; center window again, size of window and screen does not matter Local $aPos = WinGetPos($hGUI) WinMove($hGUI, "", (@DesktopWidth / 2) - ($aPos[2] / 2), (@DesktopHeight / 2) - ($aPos[3] / 2)) Sleep(1000) Edited December 27, 2011 by Robjong Link to comment Share on other sites More sharing options...
JScript Posted December 27, 2011 Share Posted December 27, 2011 @iRAWRRichard2Regards,João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Beege Posted December 27, 2011 Share Posted December 27, 2011 iRAWRRichard, If your just trying to center the app then just divide desktop widths and heights by 2 like JS said. If your going for a different location, I treat the cordinates as a percentage ratio. For example if the GUI sits at 100,100 on a 1024x768 resolution, a similar location on 1440x900 would be (100/1024) * 1440 -> 140.625 (100/768) * 900 -> 117.1875 So you end up with 141, 117 iRAWRRichard 1 Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
iRAWRRichard Posted December 27, 2011 Author Share Posted December 27, 2011 Percent ratio. I hadn't thought of that. That's exactly the answer I needed. Thanks! :] Link to comment Share on other sites More sharing options...
Beege Posted December 27, 2011 Share Posted December 27, 2011 Sure thing Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator 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