GodForsakenSoul Posted June 9, 2010 Share Posted June 9, 2010 i'm trying to get my proggy to start up with TWO GUIS at the same time. lots of trial and error lead me to nothing i can work with. is it possible to accomplish, specifically on a machine WITHOUT AutoIT? (no run(<filename.au3>)) Link to comment Share on other sites More sharing options...
norax Posted June 9, 2010 Share Posted June 9, 2010 with 2 autoit scripts possibly, but ive tried this myself from several different approaches and nothing i ended up using a context menu to suit my needs Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted June 9, 2010 Author Share Posted June 9, 2010 (edited) elaborate on the "context menu" part please O_o i'm searching the help file as we speak Edited June 9, 2010 by GodForsakenSoul Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 9, 2010 Share Posted June 9, 2010 (edited) It's not at all difficult. You can have as many GUIs from one script as you want. Each GuiCreate() returns a unique handle to be used for further processing in either GuiGetMsg() or event modes. If you use a message loop, you'll want it to use the advanced flag (see help file) so you know which GUI the message came from. Edit: Added fun demo: #include <GuiConstantsEx.au3> GuiCreate("Test Multiple GUIs", 300, 300, Random(100, @DesktopWidth - 400, 1), Random(100, @DesktopHeight - 400)) GUICtrlCreateButton("CREATE", 100, 100, 100, 30) GUICtrlCreateButton("DELETE", 100, 200, 100, 30) GUISetState() Do $aMsg = GUIGetMsg(1) ; 1 = advanced mode Select Case $aMsg[0] = $GUI_Event_CLOSE GUIDelete($aMsg[1]) Case ControlGetText($aMsg[1], "", $aMsg[2]) = "CREATE" GuiCreate("Test Multiple GUIs", 300, 300, Random(100, @DesktopWidth - 400, 1), Random(100, @DesktopHeight - 400)) GUICtrlCreateButton("CREATE", 100, 100, 100, 30) GUICtrlCreateButton("DELETE", 100, 200, 100, 30) GUISetState() Case ControlGetText($aMsg[1], "", $aMsg[2]) = "DELETE" GUIDelete($aMsg[1]) EndSelect Until Not WinExists("Test Multiple GUIs", "") Edited June 9, 2010 by PsaltyDS 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...
norax Posted June 9, 2010 Share Posted June 9, 2010 elaborate on the "context menu" part please O_oi'm searching the help file as we speakright but when i open a form$form1 guicreate$form2 guicreateetc and try to show them both at same time only 1 will display with data from both, and ive made sure to use only set variables to establish "dialog ids"this i assume was his issue Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted June 9, 2010 Author Share Posted June 9, 2010 so... just write all my guis in one function, have it called, and the figure out what gui sent what? also, which advanced section? style or exstyle? Link to comment Share on other sites More sharing options...
norax Posted June 9, 2010 Share Posted June 9, 2010 not multiple controls multiple guicreate that exist with eachother Link to comment Share on other sites More sharing options...
GodForsakenSoul Posted June 9, 2010 Author Share Posted June 9, 2010 (edited) @psalty: if i got your code correctly, ControlGetText(<GuiGetMsg variable>, <the text it should expect>, <the variable into which the text is read>) = "<the text>" am i right? edit: crud, i'm using images instead of buttons. this doesn't seem to work well on images.... Edited June 9, 2010 by GodForsakenSoul Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 9, 2010 Share Posted June 9, 2010 GuiGetMsg() is returning an array ($aMsg in my demo). The handle of the window is in $aMsg[1] and the handle of the control is in $aMsg[2]. So the effect is: ControlGetText(<handle of the window>, "", <handle of the control>) = "<Text To Match>" The message (maybe control ID) is in $aMsg[0], but I didn't bother to save those anywhere for future reference when creating the controls, so I don't bother checking it. 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...
GodForsakenSoul Posted June 9, 2010 Author Share Posted June 9, 2010 i see. that was rather educational, but the GUI i'm building is using images instead of buttons because in this case, buttons would look ugly. the problem of course, is that .bmp's, even if they have text, autoit can't read it. can i do the same, except with the switch koda offers by default? will i still get the gui's handle when i press it? Link to comment Share on other sites More sharing options...
norax Posted June 9, 2010 Share Posted June 9, 2010 i see. that was rather educational, but the GUI i'm building is using images instead of buttons because in this case, buttons would look ugly. the problem of course, is that .bmp's, even if they have text, autoit can't read it. can i do the same, except with the switch koda offers by default? will i still get the gui's handle when i press it? when u make a gui ctrl do it like this $Button1 = GUICtrlCreateButton("", 400, 24, 145, 25) $Button2 = GUICtrlCreateButton("", 400, 0, 145, 25) then in the event switch all u do is Switch $nMsg[0] $case $button 1 button data $case button 2 button data endswitch does that make sense or am i explaining it badly lol Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 9, 2010 Share Posted June 9, 2010 i see. that was rather educational, but the GUI i'm building is using images instead of buttons because in this case, buttons would look ugly.the problem of course, is that .bmp's, even if they have text, autoit can't read it.Then keep track of the ControlIDs/Handles of the controls you create and test for those in your loop.can i do the same, except with the switch koda offers by default?will i still get the gui's handle when i press it?You have been around here too long to still be asking that kind of question. Koda-dependency is stunting your growth. 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...
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