Derak Posted July 10, 2008 Posted July 10, 2008 Here is my long code : expandcollapse popupIf $lines = 1 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $SR = StringReplace($Edit1111, "Here", $Text1, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 2 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 3 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 4 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $Text4 = _GUICtrlListBox_GetText($ListBox, 3) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3 & @CRLF & $Text4, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 5 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $Text4 = _GUICtrlListBox_GetText($ListBox, 3) $Text5 = _GUICtrlListBox_GetText($ListBox, 4) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3 & @CRLF & $Text4 & @CRLF & $Text5, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 6 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $Text4 = _GUICtrlListBox_GetText($ListBox, 3) $Text5 = _GUICtrlListBox_GetText($ListBox, 4) $Text6 = _GUICtrlListBox_GetText($ListBox, 5) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3 & @CRLF & $Text4 & @CRLF & $Text5 & @CRLF & $Text6, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 7 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $Text4 = _GUICtrlListBox_GetText($ListBox, 3) $Text5 = _GUICtrlListBox_GetText($ListBox, 4) $Text6 = _GUICtrlListBox_GetText($ListBox, 5) $Text7 = _GUICtrlListBox_GetText($ListBox, 6) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3 & @CRLF & $Text4 & @CRLF & $Text5 & @CRLF & $Text6 & @CRLF & $Text7, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 8 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $Text4 = _GUICtrlListBox_GetText($ListBox, 3) $Text5 = _GUICtrlListBox_GetText($ListBox, 4) $Text6 = _GUICtrlListBox_GetText($ListBox, 5) $Text7 = _GUICtrlListBox_GetText($ListBox, 6) $Text8 = _GUICtrlListBox_GetText($ListBox, 7) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3 & @CRLF & $Text4 & @CRLF & $Text5 & @CRLF & $Text6 & @CRLF & $Text7 & @CRLF & $Text8, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf If $lines = 9 Then $Text1 = _GUICtrlListBox_GetText($ListBox, 0) $Text2 = _GUICtrlListBox_GetText($ListBox, 1) $Text3 = _GUICtrlListBox_GetText($ListBox, 2) $Text4 = _GUICtrlListBox_GetText($ListBox, 3) $Text5 = _GUICtrlListBox_GetText($ListBox, 4) $Text6 = _GUICtrlListBox_GetText($ListBox, 5) $Text7 = _GUICtrlListBox_GetText($ListBox, 6) $Text8 = _GUICtrlListBox_GetText($ListBox, 7) $Text9 = _GUICtrlListBox_GetText($ListBox, 8) $SR = StringReplace($Edit1111, "Here", $Text1 & @CRLF & $Text2 & @CRLF & $Text3 & @CRLF & $Text4 & @CRLF & $Text5 & @CRLF & $Text6 & @CRLF & $Text7 & @CRLF & $Text8 & @CRLF & $Text9, 0, 0) GUICtrlSetData($Edit1, $SR) EndIf Thats part of 3000 lines Script!! Never mind the whole thing. I just want someone to use this "For,Next" Statement to make that long code above >> UNLIMITED. Not just Until Line = 9 and Text9. Thanx in advance. muttley [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]
Monamo Posted July 10, 2008 Posted July 10, 2008 Something along the lines of: $sReplaceTxt = "" For $i = 0 To $lines $sReplaceTxt &= _GUICtrlListBox_GetText($ListBox, $i) If $i < $lines Then $sReplaceTxt &= @CRLF EndIf Next $SR = StringReplace($Edit1111, "Here", $sReplaceTxt, 0, 0) GUICtrlSetData($Edit1, $SR) ? - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]
aslani Posted July 10, 2008 Posted July 10, 2008 Just a minor adjustment; $sReplaceTxt = "" For $i = 0 To $lines - 1 ; added -1 here because if $lines=1, then it will loop twice $sReplaceTxt &= _GUICtrlListBox_GetText($ListBox, $i) If $i < $lines Then $sReplaceTxt &= @CRLF EndIf Next $SR = StringReplace($Edit1111, "Here", $sReplaceTxt, 0, 0) GUICtrlSetData($Edit1, $SR) [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
Derak Posted July 10, 2008 Author Posted July 10, 2008 Thanx for both replies.... Its working fine now. muttley [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]
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