SoftVoile Posted December 2, 2008 Share Posted December 2, 2008 (edited) hello, what i want to do is search for *.txt files in Folder/SubFolders and write the following text at the start of file. and if the file already have the text inside it then search for next file. the text i want to add into files. "Hello " & @UserName & "," "Some information about the project." "File information is below." "'The name of this file is" & %filename% & " size: " & %filesize% & "-KB, -Located on " & %parent_folder% "-This file was last Accessed in " & %DateLastAccessed% "-and created in " & %DateCreated% "-Have a nice day ;)" "|--****--Please add other Project info Below--****--|" i have read about FileWrite(), FileWriteLine(), FindFileFirstFile(), etc but can't figure it out. any example code in 'Example Scripts'? or any information how to do it? Edited December 2, 2008 by SoftVoile Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
Andreik Posted December 2, 2008 Share Posted December 2, 2008 (edited) hello, what i want to do is search for *.txt files in Folder/SubFolders and write the following text at the start of file. and if the file already have the text inside it then search for next file. the text i want to add into files. "Hello " & @UserName & "," "Some information about the project." "File information is below." "'The name of this file is" & %filename% & " size: " & %filesize% & "-KB, -Located on " & %parent_folder% "-This file was last Accessed in " & %DateLastAccessed% "-and created in " & %DateCreated% "-Have a nice day ;)" "|--****--Please add other Project info Below--****--|" i have read about FileWrite(), FileWriteLine(), FindFileFirstFile(), etc but can't figure it out. any example code in 'Example Scripts'? or any information how to do it? Try this: #include <File.au3> $TEXT = InputBox("EXAMPLE","Write here what you want to write in files") $PATH = FileSelectFolder("SELECT","") $FILES = _FileListToArray($PATH,"*.TXT",1) For $INDEX = 1 To $FILES[0] _FileWriteToLine($PATH & "\" & $FILES[$INDEX],1,$TEXT,0) Next Edited December 2, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
SoftVoile Posted December 2, 2008 Author Share Posted December 2, 2008 Thanks Andriek for the very fast reply but on second run this code adds the same line again to the file.and if the file already have the text inside it then search for next file. Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
trancexx Posted December 2, 2008 Share Posted December 2, 2008 and if the file already have the text inside it then search for next file.Add FileRead() to read. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
FireFox Posted December 2, 2008 Share Posted December 2, 2008 (edited) Add FileRead() to read.Yes but if he use fileread for have some sentences in file, how he would do ? Edited December 2, 2008 by FireFox Link to comment Share on other sites More sharing options...
trancexx Posted December 2, 2008 Share Posted December 2, 2008 Yes but if he use fileread for have some sentences in file, how he would do ?Then he would add StringInStr() to read. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
FireFox Posted December 2, 2008 Share Posted December 2, 2008 Then he would add StringInStr() to read.I was searching for string functions, you found it lol Link to comment Share on other sites More sharing options...
SoftVoile Posted December 2, 2008 Author Share Posted December 2, 2008 (edited) Then he would add StringInStr() to read.how StringInStr() can read a *.txt file and match string?StringInStr: Checks if a string contains a given substring.also i want to search files in child Dirs/folders and it's working only for parent folder.like in @DesktopDir & "\*\*\*\etc" Edited December 2, 2008 by SoftVoile Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them. Link to comment Share on other sites More sharing options...
dbzfanatic Posted December 2, 2008 Share Posted December 2, 2008 Search the forums for recursion and also you'll need to read the file contents to a variable then use the variable in StringInStr() to check. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 2, 2008 Moderators Share Posted December 2, 2008 (edited) could always use Run() + @COMSPEC + findstr command. Edited December 2, 2008 by SmOke_N 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...
JSThePatriot Posted December 2, 2008 Share Posted December 2, 2008 Why do I get the feeling that SoftVoile isn't learning to code? He's obviously not spending anytime trying to do this on his own. What he wants done is easily done when one wants to complete it. SoftVoile, I would recommend that you start providing some of your own code as you seem to be trying to get everyone to do this for you, and that won't benefit you at all. Please post some sensible code as this isn't a hard task, even for someone new to coding. Thanks, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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