B3TA_SCR1PT3R Posted August 23, 2005 Share Posted August 23, 2005 yeah so i got a really big .txt file and i only wont the word "Directory" deleted from it how would i go about doing this..it has about 200-300 lines and the words appears about every 20-30 lines.? ..so? [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right] Link to comment Share on other sites More sharing options...
SupraNatural Posted August 23, 2005 Share Posted August 23, 2005 Why don't you just open it up and do a replace all of "directory" with "" ? Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it! Link to comment Share on other sites More sharing options...
GaryFrost Posted August 23, 2005 Share Posted August 23, 2005 probably the best way is to filereadtoarray then stringreplace for each line in the array then write the file back out. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
B3TA_SCR1PT3R Posted August 23, 2005 Author Share Posted August 23, 2005 #include <GuiConstants.au3> #include <file.au3> #include <Process.au3> GLOBAL $aRecords GuiCreate("*Insert Flashy Title Here*",700,400) $tree = GuiCtrlCreateTreeView(25,50,500,200) $BTN_1 = GuiCtrlCreateButton("List Files",100,300,75,35) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $BTN_1 _RunDOS("dir /s >> C:\~~Files.txt") _FileReadToArray("C:\~~Files.txt",$aRecords) If @error = 1 Then MsgBox(4096 + 16,"Error"," Error reading file to Array") For $x = 1 to $aRecords[0] GuiCtrlCreateTreeViewItem($aRecords[$x],$tree) Next EndSelect WEnd should i even attempt to clean out all the crap in that file? look how many stringreplace or watever id have to do? [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right] Link to comment Share on other sites More sharing options...
GaryFrost Posted August 23, 2005 Share Posted August 23, 2005 (edited) Wanting to delete the line or just the word? Example of removing the line: #include <GuiConstants.au3> #include <file.au3> #include <Process.au3> #include <Array.au3> GLOBAL $aRecords GuiCreate("*Insert Flashy Title Here*",700,400) $tree = GuiCtrlCreateTreeView(25,50,500,200) $BTN_1 = GuiCtrlCreateButton("List Files",100,300,75,35) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $BTN_1 _RunDOS("dir /s > C:\~~Files.txt") _FileReadToArray("C:\~~Files.txt",$aRecords) If @error = 1 Then MsgBox(4096 + 16,"Error"," Error reading file to Array") _CleanUp($aRecords, "Directory of") For $x = 1 to $aRecords[0] GuiCtrlCreateTreeViewItem($aRecords[$x],$tree) Next EndSelect WEnd Func _CleanUp(ByRef $aRecords, $s_remove) For $x = 1 To $aRecords[0] If StringInStr($aRecords[$x],$s_remove) Then _ArrayDelete($aRecords, $x) $aRecords[0] = $aRecords[0] - 1 EndIf Next EndFunc Edited August 23, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
B3TA_SCR1PT3R Posted August 23, 2005 Author Share Posted August 23, 2005 Wanting to delete the line or just the word?Example of removing the line:#include <GuiConstants.au3> #include <file.au3> #include <Process.au3> #include <Array.au3> GLOBAL $aRecords GuiCreate("*Insert Flashy Title Here*",700,400) $tree = GuiCtrlCreateTreeView(25,50,500,200) $BTN_1 = GuiCtrlCreateButton("List Files",100,300,75,35) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $BTN_1 _RunDOS("dir /s > C:\~~Files.txt") _FileReadToArray("C:\~~Files.txt",$aRecords) If @error = 1 Then MsgBox(4096 + 16,"Error"," Error reading file to Array") _CleanUp($aRecords, "Directory of") For $x = 1 to $aRecords[0] GuiCtrlCreateTreeViewItem($aRecords[$x],$tree) Next EndSelect WEnd Func _CleanUp(ByRef $aRecords, $s_remove) For $x = 1 To $aRecords If StringInStr($aRecords[$x],$s_remove) Then _ArrayDelete($aRecords, $x) $aRecords[0] = $aRecords[0] - 1 EndIf Next EndFunc<{POST_SNAPBACK}>hey thanks alot man this is exactly wat i needed .....but it only removes the first "Directory of"im thinkin a Do...Until (array = 0) but i dont know how to word that..or anything else would be fine to [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right] Link to comment Share on other sites More sharing options...
GaryFrost Posted August 23, 2005 Share Posted August 23, 2005 Noticed that also, fixed it: expandcollapse popup#include <GuiConstants.au3> #include <file.au3> #include <Process.au3> #include <Array.au3> GLOBAL $aRecords GuiCreate("*Insert Flashy Title Here*",700,400) $tree = GuiCtrlCreateTreeView(25,50,500,200) $BTN_1 = GuiCtrlCreateButton("List Files",100,300,75,35) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Select Case $msg = $BTN_1 _RunDOS("dir /s > C:\~~Files.txt") _FileReadToArray("C:\~~Files.txt",$aRecords) If @error = 1 Then MsgBox(4096 + 16,"Error"," Error reading file to Array") _CleanUp($aRecords, "Directory of") For $x = 1 to $aRecords[0] GuiCtrlCreateTreeViewItem($aRecords[$x],$tree) Next EndSelect WEnd Func _CleanUp(ByRef $aRecords, $s_remove) $x = 1 do $aRecords[$x] = StringStripCR($aRecords[$x]) If Stringlen($aRecords[$x]) = 0 Then _ArrayDelete($aRecords, $x) $aRecords[0] = $aRecords[0] - 1 ElseIf StringInStr($aRecords[$x],$s_remove) Then _ArrayDelete($aRecords, $x) $aRecords[0] = $aRecords[0] - 1 Else $x = $x + 1 EndIf Until $x = $aRecords[0] EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
B3TA_SCR1PT3R Posted August 23, 2005 Author Share Posted August 23, 2005 hey how many files do you have in your tree list thing mynes 6000+ [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right] Link to comment Share on other sites More sharing options...
GaryFrost Posted August 23, 2005 Share Posted August 23, 2005 ouch, 2000+ but i have a fileserver so this one doesn't get cluttered. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
B3TA_SCR1PT3R Posted August 23, 2005 Author Share Posted August 23, 2005 (edited) ouch, 2000+ but i have a fileserver so this one doesn't get cluttered.<{POST_SNAPBACK}>ah so....now comes the hardest task.........making treeitems for each directory <<thats how i feel combined for >> hey theres something to brag about to the ladies...(6000+ files) Edited August 23, 2005 by B3TA_SCR1PT3R [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right] Link to comment Share on other sites More sharing options...
LxP Posted August 23, 2005 Share Posted August 23, 2005 2,000? 6,000? I reformatted this computer a mere week ago and my system drive contains 20,516 files without any personal files stored on it. Link to comment Share on other sites More sharing options...
B3TA_SCR1PT3R Posted August 24, 2005 Author Share Posted August 24, 2005 2,000? 6,000? I reformatted this computer a mere week ago and my system drive contains 20,516 files without any personal files stored on it.<{POST_SNAPBACK}>...wat are you running ALL windows versions? [right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right] Link to comment Share on other sites More sharing options...
LxP Posted August 24, 2005 Share Posted August 24, 2005 Nope, just one fresh install of XP Pro SP2. The Windows folder itself has 11,500 files in it though. 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