Jump to content

Recommended Posts

Posted

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

Posted

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
Posted

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.

Posted (edited)

@computername

FileWriteLine("main.txt",@computername & 'time3 -'& @hour & @min & @sec &' date3 -'&@year & @mon & @mday)
Edited 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.
Posted

Again thanks !!

I have the following code now

FileWriteLine("\\tma1-48\Software\Ultiboard\netsupport_logboek\log1.txt",@computername" -- "@MDAY"--"@MON"--"@YEAR" om "@HOUR":"@MIN":"@SEC)

but he give a error:

error in expression

What am i doing wrong here ?

thanks

  • Moderators
Posted

  Blueman said:

Again thanks !!

I have the following code now

FileWriteLine("\\tma1-48\Software\Ultiboard\netsupport_logboek\log1.txt",@computername" -- "@MDAY"--"@MON"--"@YEAR" om "@HOUR":"@MIN":"@SEC)

but he give a error:

error in expression

What am i doing wrong here ?

thanks

Compare yours with the others, and I bet you figure it out :whistle: .. 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.

Posted (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 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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...