Sign in to follow this  
Followers 0
ReaImDown

how to backspace (delete) in a .txt file

11 posts in this topic

using filewrite (or the same type of function) is it possible to backspace a certain amount of times without actually opening the file in question?


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites



Are you trying to delete some text that is in the file by overwriting what is there?

say I have a txt file, and I dont know what it says inside... now, what I want to do is (without opening it) Backspace...

say it said "This is my txt file" I want it then to say "This is my txt fil"


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

How do you expect to edit something without opening it?

$filename = "sometext.txt"
$file = FileRead($filename)
$file = StringTrimRight($file, 1)
FileDelete($filename)
FileWrite($filename, $file)
Edited by weaponx

Share this post


Link to post
Share on other sites

say I have a txt file, and I dont know what it says inside... now, what I want to do is (without opening it) Backspace...

say it said "This is my txt file" I want it then to say "This is my txt fil"

You can't change a file without opening it, it's just doesn't work that way. Like going through a door without opening it :D

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You can't change a file without opening it, it's just doesn't work that way. Like going through a door without opening it :D

I know that, I meant without having it open on my computer screen, I know I need it open, problem was, I didnt want to see it open or I would send("{BS}")

p.s. my girlfriend tried to go through a door without opening it first, that was funny as shit, hah

Edited by ReaImDown

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

Ok, I think I understand what you want to do. You want to edit the file without having the file in viewing mode on your screen. Ok that you can do.

Take a look at the following commands and review the examples for each command. It will make sence to you:

FileOpenDialog

FileOpen

FileClose

Review all the string management commands. Depending on how you want to edit the txt file is what string command you want to use. You can review all the string examples, and get a quick handle on how each one works. You should catch on quickly on how the string command name tells what it does. Example: StringLeft returns a number of characters from the left-hand side of a string. StringRight returns a number of characters from the right-hand side of a string.

Share this post


Link to post
Share on other sites

Ok, I think I understand what you want to do. You want to edit the file without having the file in viewing mode on your screen. Ok that you can do.

Take a look at the following commands and review the examples for each command. It will make sence to you:

FileOpenDialog

FileOpen

FileClose

Review all the string management commands. Depending on how you want to edit the txt file is what string command you want to use. You can review all the string examples, and get a quick handle on how each one works. You should catch on quickly on how the string command name tells what it does. Example: StringLeft returns a number of characters from the left-hand side of a string. StringRight returns a number of characters from the right-hand side of a string.

this is what I am looking for basically (doesnt work predictably)

$a = fileopen("a.txt",1)

FileWrite($a, "{Bs}")

FileClose($a)

but that is basically what I would want, if it would work :D


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

I posted the code way back at the beginning...

#510119

Share this post


Link to post
Share on other sites

I posted the code way back at the beginning...

#510119

sorry boss, missed that, guess I read it b4 u edited it...thank you very much :D


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

sorry boss, missed that, guess I read it b4 u edited it...thank you very much :D

The only edit I did was to add autoit tags.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0