colombeen Posted October 14, 2014 Share Posted October 14, 2014 (edited) Hi I've added this part to my script to check (when you exit the script) if you have changed the location of the app on the screen and i save it to an ini file : If @Compiled = 1 Then WinActivate($DigiAD, "") Local $Handle = WinGetHandle($DigiAD, "") $RFScreenPos = WinGetPos($Handle, "") If Not FileExists ($AppDataDir) Then DirCreate ($AppDataDir) IniWrite($DigiAD_INI, "PosX", "value", $RFScreenPos[0]) IniWrite($DigiAD_INI, "PosY", "value", $RFScreenPos[1]) EndIf FYI : $DigiAD is the handle of the GUI $AppDataDir is the location where the ini-file gets saved $DigiAD_INI is $AppDataDir + ini file name when I open my script it reads these values and places the GUI at the specified location on the screen. but what happens when you had 2 screens, you placed the app on the second screen, remove the second screen and then start the app again... would the GUI open outside of the visible area of the screen or would it just place it on the default location if the X or Y position is "out of reach"? Is there a way to check if the total screen resolution is smaller or bigger than the PosX or PosY? this is how I create the GUI : If FileExists ($DigiAD_INI) And @Compiled = 1 Then $DigiAD = GUICreate ("Digipolis Active Directory tool", 900, 700, IniRead ($DigiAD_INI, "PosX", "value", 0), IniRead ($DigiAD_INI, "PosY", "value", 0)) Else $DigiAD = GUICreate ("Digipolis Active Directory tool", 900, 700) EndIf I can't test that here. Edited October 14, 2014 by colombeen Link to comment Share on other sites More sharing options...
Solution jguinch Posted October 14, 2014 Solution Share Posted October 14, 2014 You can get the desktop position and size with WinGetPos("[TITLE:Program Manager; CLASS:Progman]"), and the test if your coords are in the range : $aDesktopPos = WinGetPos("[TITLE:Program Manager; CLASS:Progman]") If $posX < $aDesktopPos[0] OR $posX > $aDesktopPos[0] + $aDesktopPos[2] OR $posY < $aDesktopPos[1] OR $posY > $aDesktopPos[1] + $aDesktopPos[3] Then $posX = Default $posY = Default EndIf Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
colombeen Posted October 14, 2014 Author Share Posted October 14, 2014 Hi jguinch my posX and posY values are the values that you just retrieved with $aDesktopPos. that's not the issue. My problem is that I can't find a way to see if the X and Y positions are within the total screen resolution because i don't know how to see the total screen resolution when you have more then one screen. Link to comment Share on other sites More sharing options...
UEZ Posted October 14, 2014 Share Posted October 14, 2014 (edited) I've 3 screens with a overall reolution of 4960x1050 px. #include <Array.au3> $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") $aFullScreen = WinGetPos($hFullScreen) ConsoleWrite(@DesktopWidth & "x" & @DesktopHeight & @CRLF) _ArrayDisplay($aFullScreen) Row|Col 0 [0]|-1680 [1]|0 [2]|4960 [3]|1050 That means when the GUI pos is < -gui width or > @desktopwidth or < -gui height or > @desktopheight that the GUI is not on your main screen. Br, UEZ Edited October 14, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
colombeen Posted October 14, 2014 Author Share Posted October 14, 2014 oh crap, i'm so sorry! i misread what jguinch was trying to tell me. I'll try that in a moment. thx 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