Jump to content

Recommended Posts

Posted

I have a temp file, which stores necessary variables.  One of them is, how often a script was called. Now I'm searching for a way, how to increase the number in the file by one.

This is what I've already got:

$oldnum = FileReadLine($tempFileName, $line)
FileWriteLine($tempFileName, $oldnum + 1)

But FileWriteLine just adds a line at the bottom of the file. But I want to overwrite a given line (e.g. line number 7)

Thanks,

Reinhardt1Julian

  • Moderators
Posted

Reinhardt1julian,

_FileWriteToLine is what you are looking for. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

$Filepathe ="D:\FolderEx1\FolderEx\Ex.txt"
_ReplaceStringInFile($Filepathe, "100", "10",1)

100 will be Replaced with 10 in a file.

Are you looking for that???

Edited by Starstar

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Posted

Starstar, answer was already provided.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
×
×
  • Create New...