ChrisL Posted October 13, 2007 Share Posted October 13, 2007 I have a control called Edit2 on an external GUI I can use ControlSetText("Frontier","","Edit2","12") And change the text, but I can't read it ControlGetText("Frontier","","Edit2") and neither can AU3info, I assume Au3info uses the same procedure as Autoit. (is it written in autoit?) For some reason it always returns blank even after I have just set the text. Why would this be? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Valuater Posted October 13, 2007 Share Posted October 13, 2007 This is a good example of use Run("notepad.exe") WinWaitActive("") ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window" & @CRLF) Sleep(2000) $variable = ControlGetText("Untitled", "", "Edit1" ) MsgBox(0x0, "Test", $variable) Sleep(5000) ; close notepad 8) Link to comment Share on other sites More sharing options...
ChrisL Posted October 13, 2007 Author Share Posted October 13, 2007 Sorry Valuater but I don't think I'm using it wrong. It just wont read this specific Edit control. Neither will Au3info! [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Valuater Posted October 13, 2007 Share Posted October 13, 2007 (edited) Sorry Valuater but I don't think I'm using it wrong. It just wont read this specific Edit control. Neither will Au3info!Chris... You know, I believe you are not a "newby" and recognize that you have not given enough info to help youright????8) Edited October 13, 2007 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted October 13, 2007 Share Posted October 13, 2007 There's more than one way to skin a cat ... as far as i can see, you are sending text to a control... so Run("notepad.exe") WinWaitActive("") ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window") Sleep(2000) Send("^a") Sleep(1000) $variable = ControlCommand("Untitled", "", "Edit1", "GetSelected", "") MsgBox(0x0, "Test", $variable) Sleep(5000) ; close notepad ... but, no more guessing for me! 8) Link to comment Share on other sites More sharing options...
ChrisL Posted October 13, 2007 Author Share Posted October 13, 2007 If you see the attached screen shot, you will see the second control from the left has a number 12 in. You will see that Au3info can not read this text. However with Autoit you can edit the text, you can enable disable the control but you just can not read it. Manually I just highlighted the text and used Ctrl C to copy it to the clipboard and then Ctrl V to paste it in to notepad and that also returned a blank string, so I guess there is something strange about this control. What I don't understand is why, I thought that maybe it was an issue with Autoit's controlGetText() but maybe not hey. The actual code line was $sort = ControlGetText("Frontier","","Edit2") Msgbox(0,"Debug",$sort) If $sort <> "0" then Return [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted October 13, 2007 Author Share Posted October 13, 2007 If anyone is interested this is how I got round this issue.. First I found the control position and size. Then I checked the colour of the 4th pixel in and the 4th pixel down and recorded it in $startPixel because it knew it was blank Then i checked each pixel in each row of the size of the edit control, if it matched the $startPixel I recorded it as 0 if it didn't match I recorded it as 1 (I had to run this function first to get my $ZeroSort Value when writing the function) Once I have checked all of the pixels and created a new string of 0's and 1's in $pixelString I then compare this to my known value of what the edit box looks like when it only contains a Zero and this way I know that it a Zero in the box or something else. Luckily I only need to know if it is 0 or something else. I'd still like to know why I can't just read it normally though Func _CheckZeroSortSP3000() $ZeroSort = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000011100000000000000000000000000000000001000100000000000000000000000000000000010001000000000 0000000000000000000000001000100000000000000000000000000000000010001000000000000000000000000000000000 1000100000000000000000000000000000000010001000000000000000000000000000000000100010000000000000000000 00000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000" $pos = ControlGetPos("Frontier","","Edit2") If IsArray($pos) then $pixelString = "" $startPixel = PixelGetColor($pos[0]+3,$pos[1]+3) ;ConsoleWrite($startPixel & @CRLF) For $i = 4 to $Pos[3]-3 For $j = 4 to $pos[2]-3 $pixel = PixelGetColor($pos[0] + $j, $pos[1] +$i) If $pixel = $startPixel then $pixelString &=0 Else $pixelString &=1 EndIf ConsoleWrite($pixel & @crlf) Next Next ConsoleWrite($pixelString) If $PixelString <> $ZeroSort then Return 1;Means that the sort is not zero EndIf Return 0;Sort is zero Endfunc [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire 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