shyron Posted February 17, 2009 Share Posted February 17, 2009 Hi, i want to get the XXX ControLGetText("Window Name" , "XXX",'static11') like $text = "XXX" But it always says me your Variable is undeclared etc. Link to comment Share on other sites More sharing options...
martin Posted February 17, 2009 Share Posted February 17, 2009 Hi, i want to get the XXX ControLGetText("Window Name" , "XXX",'static11') like $text = "XXX" But it always says me your Variable is undeclared etc.Welcome to th eAutoIt Forums I'm not sure what you mean, but perhaps you need $text = WinGetText("WIndow Title") If not you need to explain a bit more. 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...
PsaltyDS Posted February 17, 2009 Share Posted February 17, 2009 Hi, i want to get the XXX ControLGetText("Window Name" , "XXX",'static11') like $text = "XXX" But it always says me your Variable is undeclared etc. The second parameter is window text to use if more than one window titles match the first parameter. It is part of the window ID, nothing to do with the control. If you want to specify it with a variable, then you need to declare it and give it a value before using it: $sTitle = "Window Name" $sText = "XXX" $sContText = ControLGetText($sTitle, $sText, 'static11') MsgBox(64, "Result", "Control text = " & $sContText) 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...
shyron Posted February 18, 2009 Author Share Posted February 18, 2009 I want to display $sText in a msgBox, when i do it your way Psalty, ill get XXX in the msgBox, because at the start i said its XXX Link to comment Share on other sites More sharing options...
Manjish Posted February 18, 2009 Share Posted February 18, 2009 Shyron.. You don't want to display $sText.. u want to display $sContent see, if I understand correctly what u get from WinGetText is what u want to display in msgbox.. So first put it in a variable.. $sContent And then use that variable in ur msgbox.. LIke this: $sContText = ControLGetText($sTitle, "", 'static11') MsgBox(64, "Result", "Control text = " & $sContText) $Title is the name of ur window.. which u can get from Autoit window info tool.. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
shyron Posted February 18, 2009 Author Share Posted February 18, 2009 (edited) but why is it empty? look i made a screenshotYou can see that there is "connected" not nothing Edited February 18, 2009 by shyron Link to comment Share on other sites More sharing options...
Andreik Posted February 18, 2009 Share Posted February 18, 2009 Don't forget to replace "Your title" with window title. AutoItSetOption("WinTitleMatchMode",2) $CONTENT = ControlGetText("Your title","","Static9");Put the window title MsgBox(0,"Content",$CONTENT) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 18, 2009 Share Posted February 18, 2009 I want to display $sText in a msgBox, when i do it your way Psalty, ill get XXX in the msgBox, because at the start i said its XXX That's not true. My code displays $sContText, not $sText, in the MsgBox(). Once again, $sText is window text, not control text, used help identifying the window. It is optional and can be left empty if the title is enough to ID the window: $sTitle = "Window Name" $sText = "" $sContText = ControLGetText($sTitle, $sText, 'static11') MsgBox(64, "Result", "Control text = " & $sContText) Note again that what gets displayed in the MsgBox() is $sContText which was retrieved from the control. but why is it empty? look i made a screenshot You can see that there is "connected" not nothingThe control in your screen shot is Static9 vice Static11, but that is an easy adjustment to make: $sTitle = "Window Name" $sText = "" $sContText = ControLGetText($sTitle, $sText, 'static9') MsgBox(64, "Result", "Control text = " & $sContText) The text "Connected" should be read into $sContText and displayed by the MsgBox() if the window title matches. If the window title did not match, or matched a different instance with the same title, then you get nothing back. Some error checking will help detect that: $sTitle = "Window Name" $sText = "" If WinExists($sTitle, $sText) Then $sContText = ControLGetText($sTitle, $sText, 'static9') If @error = 0 Then MsgBox(64, "Result", "Control text = " & $sContText) Else MsgBox(16, "Error", "Failed to get control text.") EndIf Else MsgBox(16, "Error", "Did not match window.") EndIf 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