longtex Posted June 17, 2008 Share Posted June 17, 2008 Is there a way to display a msgbox at a given screen location rather than centered? Or, if not, is it possible to control the screen location of a notepad window? My app here is to display a EULA and ask for confirmation. The display is via notepad (if you know a better way, I'd love to see it), and the confirmation is via msgbox(). Unfortunately, the notepad window is (always so far, anyway) on top of the msgbox() - and even if it were vice-versa it wouldn't be much better... ideally, you'd want to display the EULA and the confirmation as a single entity, but I haven't seen a good way to do that yet... so, staying with notepad/msgbox, can we control the window locations? Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 17, 2008 Share Posted June 17, 2008 Is there a way to display a msgbox at a given screen location rather than centered? Or, if not, is it possible to control the screen location of a notepad window? My app here is to display a EULA and ask for confirmation. The display is via notepad (if you know a better way, I'd love to see it), and the confirmation is via msgbox(). Unfortunately, the notepad window is (always so far, anyway) on top of the msgbox() - and even if it were vice-versa it wouldn't be much better... ideally, you'd want to display the EULA and the confirmation as a single entity, but I haven't seen a good way to do that yet... so, staying with notepad/msgbox, can we control the window locations? You could add the TopMost attribute to your MsgBox(), for example: MsgBox(32+3+262144, "EULA", "Do you consent to my EULA?") If you want to do more with it than the bits allow in the help file, build your own GUI instead of using MsgBox(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
longtex Posted June 17, 2008 Author Share Posted June 17, 2008 (edited) You could add the TopMost attribute to your MsgBox(), for example: MsgBox(32+3+262144, "EULA", "Do you consent to my EULA?") If you want to do more with it than the bits allow in the help file, build your own GUI instead of using MsgBox(). No disagreement here. As I mentioned, putting the msgbox() on top isn't really much of an improvement.... I thought probably someone had written a function to display text and solicit response... but apparently not... I've been dredging through example scripts, looking for a udf that just displays a text file, since that should be fairly easy to add on the response, but either it doesn't exist, or I haven't hit on the right combination of keywords yet. Thanks for the response! Edited June 17, 2008 by longtex Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? Link to comment Share on other sites More sharing options...
cartman380 Posted June 18, 2008 Share Posted June 18, 2008 (edited) You do have a few options, one is to use WinGetPos("title of window") which returns an array then use those numbers to place the box within the position of that window, or somewhere relative to that position. Another way is to have a GUI created in a function call, or even just within the code itself. I have written some code that might help you out in this situation. You would just have to use a combination of FileOpen() and FileRead() or FileReadLine() depending on how you want to populate the Edit box. expandcollapse popup#include <GUIConstants.au3> #include <EditConstants.au3> #Region ### START Koda GUI section ### Form= $frmEULA = GUICreate("EULA", 633, 459, -1, -1) $edEULA = GUICtrlCreateEdit("", 8, 8, 617, 401, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN)) GUICtrlSetData(-1, "The text of the EULA") $btnAgree = GUICtrlCreateButton("I Agree", 336, 424, 75, 25, 0) $btnDisagree = GUICtrlCreateButton("I Disagree", 208, 424, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnAgree ; go back to the rest of your script by doing an exit loop, or a return 1 perhaps it's your choice GUIDelete($frmEULA) ExitLoop Case $btnDisagree ; you can message come on the screen saying they need to select agree or Exit or just exit the program again choice is yours $winPos = WinGetPos("EULA", "text of the EULA"); just need some text to make absolutely sure you have the right window $xPos = $winPos[0] + $winPos[2] / 2; center of EULA screen on x axis $yPos = $winPos[1] + $winPos[3] / 2; center of EULA screen on y axis ConsoleWrite($xPos & ", " & $yPos) #Region ### START Koda GUI section ### Form= $frmExit = GUICreate("Exit", 207, 168, $xPos, $yPos, -1, -1, $frmEULA) $Label1 = GUICtrlCreateLabel("Are you sure you want to disagree? " & @CRLF & "This will cause the program to exit", 16, 32, 404, 41) $btnYes = GUICtrlCreateButton("Yes", 112, 112, 75, 25, 0) $btnNo = GUICtrlCreateButton("No", 16, 112, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($frmExit) ExitLoop Case $btnYes Exit Case $btnNo GUIDelete($frmExit) ExitLoop EndSwitch WEnd EndSwitch WEnd Edited June 18, 2008 by cartman380 Link to comment Share on other sites More sharing options...
longtex Posted June 18, 2008 Author Share Posted June 18, 2008 You do have a few options, one is to use WinGetPos("title of window") which returns an array then use those numbers to place the box within the position of that window, or somewhere relative to that position. Another way is to have a GUI created in a function call, or even just within the code itself. I have written some code that might help you out in this situation. You would just have to use a combination of FileOpen() and FileRead() or FileReadLine() depending on how you want to populate the Edit box.code snipped for brevity ...Thanks - I'll give that a try. I just got a copy of the library ULA - it's unbelievable... apparently now you can't even use a public internet-connected computer without photo ID. I'm starting to regret enabling this, but I guess it's going to happen anyway, given the chicken-hearted nature of the board members, so I might as well at least save the lib some buckage...Thanks again - I'll report back on how it works out. Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too? 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