Jump to content

need help with ControlGetText, or ....


Recommended Posts

Hi All, ...

I'm trying to read the number of selected movies from a control, and if the number of selected movies is 0, then I wantto do something, ... likewise, if the number is over 20, I want to do something else ...

so far I have

$text=ControlGetText("Export to HTML","","TRadioButton6")

which returns ... Selected Movies (123)

I need only the number between the paren. so I can check to see what value it is.

Can anyone be of some help? ... I need to go from

$text ="Selected Movies (123)" to ...

$numberselected="123"

thank you

Allen

Link to comment
Share on other sites

Use GUICtrlRead().

Hi, thanks for the reply!

WinWaitActive("Export to HTML")

$text=GUICtrlRead("TRadioButton6",1)

When I tried the above, either with 1 or without, .... $text always shows 0

Yet the control is showing Selected Movies (123)

humble "grasshoppa" needs a little more help.

Allen

Link to comment
Share on other sites

Hi All, ...

I'm trying to read the number of selected movies from a control, and if the number of selected movies is 0, then I wantto do something, ... likewise, if the number is over 20, I want to do something else ...

so far I have

$text=ControlGetText("Export to HTML","","TRadioButton6")

which returns ... Selected Movies (123)

I need only the number between the paren. so I can check to see what value it is.

Can anyone be of some help? ... I need to go from

$text ="Selected Movies (123)" to ...

$numberselected="123"

thank you

Allen

To get the number between brackets

$str= "Selected Movies (123)"
$val = stringregexp($str,"\((\d*)\)",1)
if isarray($val) then $number = $val[0]

Or maybe better use

#include <string.au3>
$number = Number(_StringBetween($text,"(",")"))
Edited by martin
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

GUICtrlRead ( controlID )

controlID is the control identifier returned by GuiCtrlCreate.

Maybe GUICtrlRead($TRadioButton6).

legiom455 already can read the text as I understand it. GuiCtrlRead is only for reading controls in your own gui. To read the text in an external window the OP has correctly used ControlGetText. Edited by martin
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

legiom455 already can read the text as I understand it. GuiCtrlRead is only for reading controls in your own gui. To read the text in an external window the OP has correctly used ControlGetText.

My bad. I understand that legiom455 don't know how to read a number form a control.

I'm trying to read the number of selected movies from a control

When the words fail... music speaks.

Link to comment
Share on other sites

To get the number between brackets

$str= "Selected Movies (123)"
$val = stringregexp($str,"\((\d*)\)",1)
if isarray($val) then $number = $val[0]

Or maybe better use

#include <string.au3>
$number = Number(_StringBetween($text,"(",")"))

The first one works, .. but fo rsome reason, I couldn;t get the second one to spit out the number, .. all I got was 0. :P

Allen

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...