Christian Blackburn Posted May 25, 2017 Share Posted May 25, 2017 Hi Guys, I've set the vertical height of my InputBox to the screen resolution height minus the taskbar. The height bit works great, but consequentially the window is no longer centered. The first 0 in the InputBox parameters below is the Left property. I can't set it to -1 nor just omit it leaving a comma as in ".. $Usable_Screen_Area[3],, 0". Is there any easy way to get my Window centered shy of a separate program that launches just before, waits for my InputBox, an then centers it. I would think -1 would just equate to centered, but it isn't valid input according to SciTe. ;Needed to get usable screen area #include <WinAPI.au3> ;$Usable_Screen_Area[3] = screen height minus the taskbar on the current screen which may or may not have a taskbar Local $Usable_Screen_Area = _GetDesktopArea() ;The M2 means a 1-2 character value is required, $Usable_Screen_Area[3] is the screen's height minus the taskbar if there's a taskbar on the current screen $Response = InputBox("Simulator", "Please enter the index you'd like to simulate?" & @CR & $Options, "", " M2", -1, $Usable_Screen_Area[3],0, 0) Thanks for your help, Christian Christian Blackburn, A+, Network+ Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 25, 2017 Share Posted May 25, 2017 (edited) ;Needed to get usable screen area #include <WinAPI.au3> ;$Usable_Screen_Area[3] = screen height minus the taskbar on the current screen which may or may not have a taskbar Local $Usable_Screen_Area = _GetDesktopArea() ;The M2 means a 1-2 character value is required, $Usable_Screen_Area[3] is the screen's height minus the taskbar if there's a taskbar on the current screen $Response = InputBox("Simulator", "Please enter the index you'd like to simulate?" & @CR & $Options, "", " M2", -1, $Usable_Screen_Area[3],Default, 0) Have you tried this? I can't really test it because I don't have the desktop area part of your code. EDIT: I tested it, seems to work. Edited May 25, 2017 by anthonyjr2 Christian Blackburn 1 UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
Malkey Posted May 26, 2017 Share Posted May 26, 2017 This example is for one monitor. For an input box to appear on either of two monitors, see the example of _WinAPI_GetMonitorInfo function in AutoIt help file. #include <WinAPISys.au3> $Response = InputBox("Simulator", "Please enter the index you'd like to simulate?", "", " M3", _ - 1, DllStructGetData(_WinAPI_GetMonitorInfo(1)[1], 4), Default, 0) Christian Blackburn 1 Link to comment Share on other sites More sharing options...
Christian Blackburn Posted May 26, 2017 Author Share Posted May 26, 2017 Hi Malkey, Thank you very much. I wish "-1" was acceptable, but your "default" keyword that I didn't know about worked like a charm. Thanks, Christian Blackburn Christian Blackburn, A+, Network+ Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 26, 2017 Share Posted May 26, 2017 (edited) Damn, looks like I got no credit Edited May 26, 2017 by anthonyjr2 UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
Christian Blackburn Posted June 6, 2017 Author Share Posted June 6, 2017 Hi Malkey and AnthonyJr2, Thank you both very much for your tips. Anthony's code worked great. Sorry I failed to give credit where it was plainly due. Thanks, Christian Blackburn Christian Blackburn, A+, Network+ 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