YellowLab Posted September 13, 2010 Share Posted September 13, 2010 I have a script where I make a bunch of GUI windows - like 30-40. They get named with an asterik and then a number based on their location in a matrix, i.e. *0, *1, *2. Everything works fine when all the GUI windows are visible. Crazy things happen when the GUIs are not visible and then shown later. The following script shows the behavior. The first part of the script creates 21 GUI's sequentially numbered and shows them immediately after creation. The second part of the script (after you press escape), the GUI's are sequentially created, but not shown until after all are created and then shown. For $i=0 to 21 GUICreate('*'&$i,150,15,20,0+$i*20) GUISetState(@SW_SHOW,WinGetHandle('*'&$i)) Next Do $nMsg=GUIGetMsg() Until $nMsg=-3 For $i=0 to 21 GUIDelete(WinGetHandle('*'&$i)) Next For $i=0 to 21 GUICreate('*'&$i,150,15,20,0+$i*20) Next For $i=0 to 21 GUISetState(@SW_SHOW,WinGetHandle('*'&$i)) Next $arTemp=WinGetPos('*1') ConsoleWrite("Y Position of Window *1 - "&$arTemp[1]&@CRLF) $arTemp=WinGetPos('*19') ConsoleWrite("Y Position of Window *19 - "&$arTemp[1]&@CRLF) Do $nMsg=GUIGetMsg() Until $nMsg=-3 Two of them are missing #1 and #19. The console reports Window *1 to be at 360 or position 18. The console reports Window *19 to be at 380, where it should be 19*20=380. In addition, in the first part of the script - #21 - the last GUI created is the focus. However, in the second part of the script, #20 (the last minus one created) is the focus. My guess is that I am missing something incredibly simple, but I am pulling my hair out trying to figure this one out. Any help would be appreciated. Thanks. You can't see a rainbow without first experiencing the rain. Link to comment Share on other sites More sharing options...
martin Posted September 13, 2010 Share Posted September 13, 2010 I have a script where I make a bunch of GUI windows - like 30-40. They get named with an asterik and then a number based on their location in a matrix, i.e. *0, *1, *2. Everything works fine when all the GUI windows are visible. Crazy things happen when the GUIs are not visible and then shown later. The following script shows the behavior. The first part of the script creates 21 GUI's sequentially numbered and shows them immediately after creation. The second part of the script (after you press escape), the GUI's are sequentially created, but not shown until after all are created and then shown. For $i=0 to 21 GUICreate('*'&$i,150,15,20,0+$i*20) GUISetState(@SW_SHOW,WinGetHandle('*'&$i)) Next Do $nMsg=GUIGetMsg() Until $nMsg=-3 For $i=0 to 21 GUIDelete(WinGetHandle('*'&$i)) Next For $i=0 to 21 GUICreate('*'&$i,150,15,20,0+$i*20) Next For $i=0 to 21 GUISetState(@SW_SHOW,WinGetHandle('*'&$i)) Next $arTemp=WinGetPos('*1') ConsoleWrite("Y Position of Window *1 - "&$arTemp[1]&@CRLF) $arTemp=WinGetPos('*19') ConsoleWrite("Y Position of Window *19 - "&$arTemp[1]&@CRLF) Do $nMsg=GUIGetMsg() Until $nMsg=-3 Two of them are missing #1 and #19. The console reports Window *1 to be at 360 or position 18. The console reports Window *19 to be at 380, where it should be 19*20=380. In addition, in the first part of the script - #21 - the last GUI created is the focus. However, in the second part of the script, #20 (the last minus one created) is the focus. My guess is that I am missing something incredibly simple, but I am pulling my hair out trying to figure this one out. Any help would be appreciated. Thanks. Try adding this line to the start of your script Opt("WinTitleMatchModew",3) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
YellowLab Posted September 13, 2010 Author Share Posted September 13, 2010 Try adding this line to the start of your scriptOpt("WinTitleMatchModew",3)See, I knew it was something simple.Thanks, martin - my head thanks you too You can't see a rainbow without first experiencing the rain. 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