erikson Posted February 7, 2007 Share Posted February 7, 2007 heloo! i have a gui with some radio buttons like Key: 1 , Key: 3 etc i have GUICtrlSetOnEvent(-1, "getkey") and Func getkey() FileWrite ("c:\test.txt", ControlGetText("","",@GUI_CtrlId) ) EndFunc in the file c:\test.txt appear the choice that i made from gui window , like Key: 1 or Key: 3 all i whant is to trim " @GUI_CtrlId " to give me the choice i made without "Key: " , like "1" or "3" etc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 7, 2007 Moderators Share Posted February 7, 2007 Opt('GUIONEVENTMODE', 1) $GUI = GUICreate('', 50, 50, -1, -1, 0x80000000) $B = GUICtrlCreateButton('Key: 1', 0, 0, 50, 50) GUICtrlSetOnEvent($B, '_EVENTHANDLER') GUISetState() While 1 Sleep(100000) WEnd Func _EVENTHANDLER() Switch @GUI_CtrlId Case $B Local $aArray = StringRegExp(ControlGetText('', '', $B), '(?i)key:\s*(.*?)$', 1) If IsArray($aArray) Then MsgBox(64, 'Example', 'Found:' & @CR & $aArray[0]) Exit EndSwitch Return '' EndFunc 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. Link to comment Share on other sites More sharing options...
erikson Posted February 7, 2007 Author Share Posted February 7, 2007 a faster method $String = ControlGetText("","",@GUI_CtrlId) $OutPut = StringRight($String, StringInStr($String, "Key: ") + 1) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 7, 2007 Moderators Share Posted February 7, 2007 a faster method $String = ControlGetText("","",@GUI_CtrlId)$OutPut = StringRight($String, StringInStr($String, "Key: ") + 1)Not hardly. 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. 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