Cha0sBG Posted August 18, 2008 Share Posted August 18, 2008 Hey i looked at the help file for it but didn't quite understand it i need to replace a text from 1 input box with anothere text in second input box. if the text in the first input box is GO(200,105) to replace with "200","105","1" keep the numbers but change Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2008 Share Posted August 18, 2008 Look here an example: $GUI = GUICreate("Prog",100,100) $INP1 = GUICtrlCreateInput("GO(" & Random(1,100,1) & "," & Random(1,100,1) & ")",5,5,90,20) $INP2 = GUICtrlCreateInput("",5,50,90,20) $REPLACE = GUICtrlCreateButton("Replace",5,75,90,20) GUISetState() While 1 $MSG = GUIGetMsg() If $MSG = $REPLACE Then $DATA = StringSplit(GUICtrlRead($INP1),"(") $DATA = StringSplit(StringMid($DATA[2],1,StringLen($DATA[2])-1),",") $DATA = '"' & $DATA[1] & '","' & $DATA[2] & '","1"' GUICtrlSetData($INP2,$DATA) ElseIf $MSG = -3 Then Exit EndIf WEnd When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 18, 2008 Author Share Posted August 18, 2008 but if the first input box where is GO...... is multilined ? and have more lines with more GO..... ? Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2008 Share Posted August 18, 2008 (edited) but if the first input box where is GO...... is multilined ? and have more lines with more GO..... ? You don't said that. Try this: #Include <String.au3> $GUI = GUICreate("Prog",100,100) $INP1 = GUICtrlCreateInput("GO(" & Random(1,100,1) & "," & Random(1,100,1) & ")",5,5,90,20) $INP2 = GUICtrlCreateInput("",5,50,90,20) $REPLACE = GUICtrlCreateButton("Replace",5,75,90,20) GUISetState() While 1 $MSG = GUIGetMsg() If $MSG = $REPLACE Then $DATA = StringSplit(GUICtrlRead($INP1),Chr(13)) For $INDEX = 1 To $DATA[0] $DATA = _StringBetween($DATA[$INDEX],"(",")") $DATA = StringSplit($DATA[0],",") $DATA = '"' & $DATA[1] & '","' & $DATA[2] & '","1"' GUICtrlSetData($INP2,$DATA) Next ElseIf $MSG = -3 Then Exit EndIf WEnd Create you the multiline input box and test script. Edited August 18, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 18, 2008 Author Share Posted August 18, 2008 Here is the error i get Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2008 Share Posted August 18, 2008 Look at my edit. Try now. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 18, 2008 Author Share Posted August 18, 2008 (edited) same expandcollapse popup#Include <GuiConstantsEx.Au3> #Include <EditConstants.au3> #Include <String.au3> $GUI = GUICreate("AgBot Script Converter", 500, 300) $Dir1 = GUICtrlCreateInput("", 10, 50, 150, 20) $INP1 = GUICtrlCreateInput("", 10, 80, 200, 200, BitOR($ES_MULTILINE,$ES_AUTOHSCROLL,$ES_AUTOVSCROLL)) $Browse1 = GUICtrlCreateButton("Open", 165, 50, 45, 20) $Browse2 = GUICtrlCreateButton("Save To", 290, 50, 100, 20) $INP2 = GUICtrlCreateInput("", 290, 80, 200, 200, BitOR($ES_MULTILINE,$ES_AUTOHSCROLL,$ES_AUTOVSCROLL)) $REPLACE = GUICtrlCreateButton("Replace",100, 5) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf If $msg = $Browse1 Then $H = FileOpenDialog("Select Tbot Script", @DesktopCommonDir, "TBot Scripts (*.TxT)", 1 + 4) GUICtrlSetData($Dir1, $H) $File = FileRead($H) If $File = "" Then MsgBox(0, "Empty File", "The File Is Empty") EndIf GUICtrlSetData($INP1, $File) FileClose($File) EndIf If $msg = $Browse2 Then $B = FileSaveDialog("Select Where To Save", @DesktopCommonDir, "AgBot Script Files (*.lst)", "Default Agbot Script") EndIf If $MSG = $REPLACE Then $DATA = StringSplit(GUICtrlRead($INP1),Chr(13)) For $INDEX = 1 To $DATA[0] $DATA = _StringBetween($DATA[$INDEX],"(",")") $DATA = StringSplit($DATA[0],",") $DATA = '"' & $DATA[1] & '","' & $DATA[2] & '","1"' GUICtrlSetData($INP2,$DATA) Next EndIf WEnd Here is my script and here is a txt file with those stuff go(95,44) go(97,59) go(110,62) go(84,66) go(51,74) go(72,83) go(84,106) go(99,91) go(121,72) go(134,44) go(140,24) go(146,5) go(131,10) go(107,28) go(96,13) go(91,4) go(104,23) just save this as txt file and open it from the program Edited August 18, 2008 by Cha0sBG Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2008 Share Posted August 18, 2008 (edited) expandcollapse popup#Include <GuiConstantsEx.Au3> #Include <EditConstants.au3> #include <File.au3> #Include <String.au3> $GUI = GUICreate("AgBot Script Converter", 500, 300) $Dir1 = GUICtrlCreateInput("", 10, 50, 150, 20) $INP1 = GUICtrlCreateInput("", 10, 80, 200, 200, BitOR($ES_MULTILINE,0x00100000,0x00200000)) $Browse1 = GUICtrlCreateButton("Open", 165, 50, 45, 20) $Browse2 = GUICtrlCreateButton("Save To", 290, 50, 100, 20) $INP2 = GUICtrlCreateInput("", 290, 80, 200, 200, BitOR($ES_MULTILINE,0x00100000,0x00200000)) $REPLACE = GUICtrlCreateButton("Replace",100, 5) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf If $msg = $Browse1 Then $H = FileOpenDialog("Select Tbot Script", @DesktopCommonDir, "TBot Scripts (*.TxT)", 1 + 4) GUICtrlSetData($Dir1, $H) $File = FileRead($H) If $File = "" Then MsgBox(0, "Empty File", "The File Is Empty") EndIf GUICtrlSetData($INP1, $File) FileClose($File) EndIf If $msg = $Browse2 Then $B = FileSaveDialog("Select Where To Save", @DesktopCommonDir, "AgBot Script Files (*.lst)", "Default Agbot Script") $FILE_SAVE = FileOpen($B,2) FileWrite($FILE_SAVE,GUICtrlRead($INP2)) FileClose($FILE_SAVE) EndIf If $MSG = $REPLACE Then $FILE_OPEN = FileOpen($H,0) $TEMP = "" For $INDEX = 1 To _FileCountLines($H) $DATA = _StringBetween(FileReadLine($FILE_OPEN,$INDEX),"(",")") $DATA = StringSplit($DATA[0],",") $DATA = '"' & $DATA[1] & '","' & $DATA[2] & '","1"' If $TEMP = "" Then GUICtrlSetData($INP2,$DATA) Else GUICtrlSetData($INP2,$TEMP & @CRLF & $DATA) EndIf $TEMP = GUICtrlRead($INP2) Next FileClose($FILE_OPEN) EndIf WEnd Edited August 18, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 18, 2008 Author Share Posted August 18, 2008 your the best !!!!!! Andreik you RULEEEEEEEEEEEEEE Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ¹ There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Andreik Posted August 18, 2008 Share Posted August 18, 2008 (edited) Look edit because now work save to file. Edited August 18, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 18, 2008 Moderators Share Posted August 18, 2008 $s_text = "go(95,44)" & @CRLF & "go(97,59)" & @CRLF & "go(110,62)" & @CRLF & _ "go(84,66)" & @CRLF & "go(51,74)" & @CRLF & "go(72,83)" & @CRLF & _ "go(84,106)" & @CRLF & "go(99,91)" & @CRLF & "go(121,72)" & @CRLF & _ "go(134,44)" & @CRLF & "go(140,24)" & @CRLF & "go(146,5)" & @CRLF & _ "go(131,10)" & @CRLF & "go(107,28)" & @CRLF & "go(96,13)" & @CRLF & _ "go(91,4)" & @CRLF & "go(104,23)" MsgBox(0, "Before", $s_text) ;Only line you need: $s_text = StringRegExpReplace($s_text, "(?i)(go\s*\(\s*)(\d+)(\s*,\s*)(\d+)(\s*\))", '"\2","\4","1"') MsgBox(0, "After", $s_text) 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