aslani Posted September 14, 2007 Posted September 14, 2007 I've been searching the forums for 2 days now and I can't seem to find what I'm looking for. So here's my problem. I have a spreadsheet in Excel that looks like this: Line#,PartNumber,,OldRev,NewRev,Type,Description,,,,,,Date,,, After converting it to comma delimited .csv file. Now my script opens that file and run StringSplit() and save it into a temporary .txt file. It is now looks like this; NumberOfSplits Line# PartNumber OldRev NewRev Type Description Date I'm trying to get rid of the blank lines and I can't seems to find the right script to do it. I know it can't be that complicated, I might just be overlooking something. Any advice? [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
PsaltyDS Posted September 14, 2007 Posted September 14, 2007 (edited) After the StringSplit() do this to clean out empty lines in the resulting array: For $n = Ubound($YourArray) - 1 To 1 Step -1 If StringStripWS($YourArray[$n], 8) = "" Then _ArrayDelete($YourArray, $n) Next $YourArray[0] = Ubound($YourArray) - 1 _ArrayDelete() is in the array.au3 UDF Edit: Forgot the "Step -1" Edited September 14, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
aslani Posted September 14, 2007 Author Posted September 14, 2007 (edited) Thanks for the fast reply. Here's a follow up question. Is the cleaned array saved into $YourArray? So if I do something like; $datas = "" For $element In $YourArray $datas = $datas & $element & @CRLF Next $file = FileOpen(@ScriptDir & "\ecotmp.txt", 2) FileWrite(@ScriptDir & "\tmp.txt", "" & $datas) FileClose($file) The tmp.txt will have the cleaned version? EDIT: Ok, nvm. It works. tyty Edited September 14, 2007 by aslani [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
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