legiom455 Posted August 11, 2008 Share Posted August 11, 2008 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 More sharing options...
Andreik Posted August 11, 2008 Share Posted August 11, 2008 Use GUICtrlRead(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
legiom455 Posted August 11, 2008 Author Share Posted August 11, 2008 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 0Yet the control is showing Selected Movies (123)humble "grasshoppa" needs a little more help.Allen Link to comment Share on other sites More sharing options...
martin Posted August 11, 2008 Share Posted August 11, 2008 (edited) 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 AllenTo 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 August 11, 2008 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 More sharing options...
Andreik Posted August 11, 2008 Share Posted August 11, 2008 GUICtrlRead ( controlID ) controlID is the control identifier returned by GuiCtrlCreate. Maybe GUICtrlRead($TRadioButton6). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
martin Posted August 11, 2008 Share Posted August 11, 2008 (edited) 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 August 11, 2008 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 More sharing options...
Andreik Posted August 11, 2008 Share Posted August 11, 2008 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 More sharing options...
legiom455 Posted August 11, 2008 Author Share Posted August 11, 2008 My bad. I understand that legiom455 don't know how to read a number form a control.thanks guys, by jove, .. i think I've got it!!!Allen Link to comment Share on other sites More sharing options...
legiom455 Posted August 11, 2008 Author Share Posted August 11, 2008 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. Allen 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