Sign in to follow this  
Followers 0
lordicast

Window Info tool , ControlGetText

8 posts in this topic

I have been trying to use the ControlGetText func to read Hyperterminal with no success the window info tool gives it a class of

SESSION_WINDOW and a Term Class INSTANCE:1 for the control

ControlGetText('[CLASS:SESSION_WINDOW]','','Term Class1')

^- Is not working any ideas


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites



Yes using,

Func WinGetTerminal()
    $var = WinList()
    For $i = 1 To $var[0][0]
        If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
            $strg = StringInStr($var[$i][0], 'HyperTerminal')
            If $strg > 0 Then
                Global $HyperTerminal = $var[$i][0]
            EndIf
        EndIf
    Next
EndFunc   ;==>WinGetTerminal

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>IsVisible

Big problem with that is the handle name constantly changes IE; Machine1 - Hyperterminal, Machine2 - Hyperterminal. This is why I use the above at the start of script.

Intresting that ControlSend does work but ControlSetText and ControlGetText dont? :)


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Yes using,

Func WinGetTerminal()
    $var = WinList()
    For $i = 1 To $var[0][0]
        If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
            $strg = StringInStr($var[$i][0], 'HyperTerminal')
            If $strg > 0 Then
                Global $HyperTerminal = $var[$i][0]
            EndIf
        EndIf
    Next
EndFunc   ;==>WinGetTerminal

Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc   ;==>IsVisible

Big problem with that is the handle name constantly changes IE; Machine1 - Hyperterminal, Machine2 - Hyperterminal. This is why I use the above at the start of script.

Intresting that ControlSend does work but ControlSetText and ControlGetText dont? :)

No need to loop through all the windows in your function.

Global $HyperTerminal = WinGetHandle("[REGEXPTITLE:(?i).*?Machine\d+ - Hyperterminal.*?\z]")

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Nice Smoke, But I im killing myself over this ControlGetText func is there any other way?


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Nice Smoke, But I im killing myself over this ControlGetText func is there any other way?

I don't have hyperterminal on this pc ( Win7, the alternative is winrs ) to test, but if it comes up like telnet or in a command prompt, you're basically SOL with traditional windows manipulation.

If it's in a command prompt, I remember Valik writing quite a few functions for 7zip that he was able to manipulate data in the command prompt ( I believe, it's been so long since I've read it ) with dll calls ( an obvious search query would be valik+7zip on this one, if the native search doesn't help, try google ).


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

@Zedna Thats copied directly off of the Window Info tool, Tried it Termclass1;Term_Class1;Term Class:1 still no luck.

Im currently looking into StdOutRead to see if thats maybe a option.


[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0