realkiller Posted September 29, 2005 Posted September 29, 2005 how can i make enter working in this filwrite filewrite ("lol.txt", "{ENTER}") Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2
Developers Jos Posted September 29, 2005 Developers Posted September 29, 2005 Enter is a key on the keyboard.. do you mean the @CRLF characters ? filewrite ("lol.txt", @crlf) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
realkiller Posted September 29, 2005 Author Posted September 29, 2005 do you know backspace 2? Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2
BigDod Posted September 29, 2005 Posted September 29, 2005 (edited) do you know backspace 2?@BSEditSeriously you could open the file for editing and do a ControlSend Edited September 29, 2005 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
Developers Jos Posted September 29, 2005 Developers Posted September 29, 2005 do you know backspace 2? You wanna write a Backspace ????? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
realkiller Posted September 29, 2005 Author Posted September 29, 2005 yes Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2
AutoChris Posted September 29, 2005 Posted September 29, 2005 Could you please explain what exactly you want to do? Figuring out how to help you from reading your post is like trying to decipher encypted Swahili with only a used napkin and an abacus.
this-is-me Posted September 30, 2005 Posted September 30, 2005 He doesn't want to write a backspace character, he wants to remove text from the end of a line in a file. Who else would I be?
realkiller Posted September 30, 2005 Author Posted September 30, 2005 yes thax for explaination Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2
LxP Posted September 30, 2005 Posted September 30, 2005 You can't write a backspace to a file.** You will need to read the entire file into memory, chop off the last character and then write the file back to disk. Something like this should do what you want: ; define location of file local $file = "C:\MyFile.txt" ; read file into a variable local $data = fileRead($file, fileGetSize($file)) ; remove final character $data = stringTrimRight($data, 1) ; write it back ; you may not have to delete the file first (documentation says it will 'append') fileDelete($file) fileWrite($file, $data) ** Technically you can append a character with ASCII code 8, but this certainly won't do what you expect.
realkiller Posted September 30, 2005 Author Posted September 30, 2005 doesnt work but thx for replying Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2
LxP Posted September 30, 2005 Posted September 30, 2005 Well, it does -- I just tested it. It depends on what's at the end of your file. Are you trying to remove a line break? Generally a line break is two bytes long for DOS/Windows files (a CR byte and an LF byte). If you're trying to remove such a sequence then you'll need to modify the above script to remove the last two characters. Try that and let us know. We are talking about manipulating a plain text file, right?
realkiller Posted September 30, 2005 Author Posted September 30, 2005 i just wanna remove last letter i typt Remote 3.1 BetaRemote Media Player ControlUSB Security 1.2
LxP Posted October 1, 2005 Posted October 1, 2005 I think I know what's going on -- you want the last character to be removed from a file that's open and displayed. File manipulation won't help you with that. My code will however do what it states. If you run the code and then re-open the file, the character will be gone. If you really want to remove the character from the open file though, then you'll need to write a script that sends Ctrl+End, Backspace and Ctrl+S to the window that has the document in it. (The keys should respectively perform end-of-file, remove character and save document.)
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