Blueman Posted February 13, 2007 Posted February 13, 2007 Hello, i have just started with scripting and it looks verry nice but i have a question. How can i by running the script change a txt file. example main txt file -------------- PC-1 time1 date1 PC-2 time2 date2 new txt file after running the script ---------------------------------------- PC-1 time1 date1 PC-2 time2 date2 PC-3 time3 date3 etc.. Many thanks
The Kandie Man Posted February 13, 2007 Posted February 13, 2007 FileWriteLine("main.txt","PC-3 time3 date3") There, that is a very simple way of doing it. You could use file handles if you want the process to be more efficient and if you want to add mass amounts of data to the txt file. Look in the help file for examples. The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
Moderators SmOke_N Posted February 13, 2007 Moderators Posted February 13, 2007 I would look at Ini* functions personally (To easily keep track of the PC#). But, FileWrite() + @Macros will do what you are asking. 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.
Blueman Posted February 13, 2007 Author Posted February 13, 2007 Thanks this works. I have another question. How can i locate the computer name ? so that PC-1 becomes namecomputer1 Again thanks
jokke Posted February 13, 2007 Posted February 13, 2007 (edited) @computername FileWriteLine("main.txt",@computername & 'time3 -'& @hour & @min & @sec &' date3 -'&@year & @mon & @mday) Edited February 13, 2007 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Blueman Posted February 13, 2007 Author Posted February 13, 2007 Again thanks !!I have the following code nowFileWriteLine("\\tma1-48\Software\Ultiboard\netsupport_logboek\log1.txt",@computername" -- "@MDAY"--"@MON"--"@YEAR" om "@HOUR":"@MIN":"@SEC)but he give a error:error in expressionWhat am i doing wrong here ?thanks
Moderators SmOke_N Posted February 13, 2007 Moderators Posted February 13, 2007 Blueman said: Again thanks !!I have the following code nowFileWriteLine("\\tma1-48\Software\Ultiboard\netsupport_logboek\log1.txt",@computername" -- "@MDAY"--"@MON"--"@YEAR" om "@HOUR":"@MIN":"@SEC)but he give a error:error in expressionWhat am i doing wrong here ?thanksCompare yours with the others, and I bet you figure it out .. Hint ... String & String 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.
jokke Posted February 13, 2007 Posted February 13, 2007 (edited) remember to use & between vars. $x = 1 $times = 10 Do $x = $x +1 FileWriteLine("main.txt", 'Computer_' & @computername & '_number' & $x & ' time'&$x&' -'& @hour & @min & @sec &' date'&$x&' -'&@year & @mon & @mday) Until $x = $times Edited February 13, 2007 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Blueman Posted February 13, 2007 Author Posted February 13, 2007 Thanks guys ! you were verry helpfull, i remember this forum This is a verry good forum ! Thanks again
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