unixu Posted March 25, 2010 Share Posted March 25, 2010 (edited) hi, i got a small problem in sorting my autoit output my output looks like this "bildungsstufe", "agi", "def", "att", "def", "agi" i want to sort the output to something like this : word1 word2 word3 word4 word5 word6 word7 word8 word9 instead of : word1 word2 word3 a.s.o is there a way to do that because the output is send to a gui. Edited March 25, 2010 by unixu Link to comment Share on other sites More sharing options...
BrettF Posted March 25, 2010 Share Posted March 25, 2010 Ehhhhhh what now? Sort the output of what? Post your code. We aint no mind readers or something. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
unixu Posted March 25, 2010 Author Share Posted March 25, 2010 (edited) i tried with a for function which schould do a linebreak every third word. didn't worked out. here is my example i tried but its not creating any files. #include<string.au3> $content = FileRead("test.txt") $newline = StringSplit($content,",") for $i=0 to UBound($newline[0]) -1 If $i == $newline[0]/$i Then FileWrite("newcontent.txt", $newline[$i] & @CRLF) Else FileWrite("newcontent.txt", $newline[$i] & " ") EndIf Next content of test.txt is att, def, att, def, agi, att, agi, att, Edited March 25, 2010 by unixu Link to comment Share on other sites More sharing options...
Beege Posted March 25, 2010 Share Posted March 25, 2010 This statment is wrong for $i=0 to UBound($newline[0]) -1 Should say.. for $i=0 to $newline[0] Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Beege Posted March 25, 2010 Share Posted March 25, 2010 Also to quickly check if fileread() and Stringsplit() worked liked you expected you could use _Arraydisplay() to view the array. #include<string.au3> #include<array.au3> $content = FileRead("test.txt") $newline = StringSplit($content,",") _Arraydisplay($newline) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
99ojo Posted March 25, 2010 Share Posted March 25, 2010 (edited) Hi, example: For $i = 1 to 99 If Mod ($i, 3) = 0 Then ConsoleWrite ($i & @CRLF) Else ConsoleWrite ($i & ", ") EndIf Next ;-)) Stefan Edited March 25, 2010 by 99ojo Link to comment Share on other sites More sharing options...
unixu Posted March 25, 2010 Author Share Posted March 25, 2010 (edited) dear beege my fileread worked as expected edit: Dear 99ojo thx your example worked perfect for my needs Edited March 25, 2010 by unixu Link to comment Share on other sites More sharing options...
Malkey Posted March 25, 2010 Share Posted March 25, 2010 Another example.; Modified from ; http://www.autoitscript.com/forum/index.php?showtopic=101594&view=findpost&p=722113 Local $sStr = "att," & @CRLF & _ "def," & @CRLF & _ "att," & @CRLF & _ "def," & @CRLF & _ "agi," & @CRLF & _ "att," & @CRLF & _ "agi," & @CRLF & _ "att," ; OR ;Local $sStr = FileRead("test.txt") MsgBox(0, 'Display 2D array style (Not an array)', _ "From: " & @CRLF & $sStr & @CRLF & @CRLF & "Display 3 columns." & @CRLF & _ " Result: " & @CRLF & _StringDisplayRE($sStr, 3, " ") & @CRLF) Func _StringDisplayRE($sStr, $iNumOfCol = 0, $SpaceType = @TAB) Return StringRegExpReplace(StringRegExpReplace($sStr, "(.*[^\v])(?:\v+)", "${1}" & $SpaceType), _ "((.*?" & $SpaceType & "){" & $iNumOfCol & "})", "${1}" & @CRLF) EndFunc ;==>_StringDisplayRE Link to comment Share on other sites More sharing options...
GEOSoft Posted March 25, 2010 Share Posted March 25, 2010 This statment is wrong for $i=0 to UBound($newline[0]) -1 Should say.. for $i=0 to $newline[0] Or for $i=0 to UBound($newline) -1 George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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