Szaky Posted July 4, 2015 Posted July 4, 2015 Hi, i'm a new here, a need some help to split a text for Ex. " This is a test 10 of 1000 " (without quotes).What i need is the numbers .. "10" & "1000". The text is not changeing only the numbers . the Script is looping. if pixel color exist then it will show a GUI whit those actual numbers. #include <GUIConstantsEx.au3>#include <StaticConstants.au3>Global $GREEN = 0x00B050Global $RED = 0xFF0000Global $get = "[CLASS:Notepad]" ;=====================> Title: Untitled - NotepadWhile 1 Global $color = PixelSearch(1120,455,1140,465,0x00B050) ; 0x00B050 = Green colorIf IsArray($color) = True Then show()WEndFunc show()Global $readT = ControlGetText($get,"","Edit1")Local $hGUI = GUICreate("Example",1200,300,250,2)GUISetState(@SW_SHOW) ;Label 1 : First Digits "10" Local $sFont = "Tahoma" GUISetFont(70,400, $sFont) $lb1 = GUICtrlCreateLabel($readT,2,2,1200,100) GUICtrlSetStyle($lb1,$SS_Center) GUICtrlSetColor($lb1,$RED) ;Label 2 : First Digits "1000" Local $sFont = "Tahoma" GUISetFont(70, 900, $sFont) $lb2 = GUICtrlCreateLabel($readT,2,150,1200,100) GUICtrlSetStyle($lb2,$SS_Center) GUICtrlSetColor($lb2,$GREEN)Sleep(5000) ;================================> The Time before the GUI gose down.!GUIDelete($hGUI)EndFunc
mikell Posted July 4, 2015 Posted July 4, 2015 This means extract the numbers from the string rather than splittingUse a regular expression for this#Include <Array.au3> $str = " This is a test 10 of 1000 " $res = StringRegExp($str, '\d+', 3) ; \d+ : one or more digits _ArrayDisplay($res)
Szaky Posted July 4, 2015 Author Posted July 4, 2015 Hi mikell, it was hard for me to understand where to implement in my script , but at the end i have the result .. Thanks for the replay. it's useful & works perfect. (Sorry for my bad english expression. i'm from Romania )
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