Jump to content

FileWrite and delete char


Recommended Posts

Hi everybody, new here.

I'm messing around with AutoIT since a few days. 

I'm actually doing some experiment on my computer, and want to do a simple textbox on my desk, and when I type some things like "chrome" then click OK or input Enter, it launch chrome.exe

Anyway, I'm storing a historic of my inputs in a txt file. And if I push my BackSpace button, I'd like to make my code delete the last character of the txt file instead of FileWrite ($historic, 'BACKSPACE') .. 


 Is there a special character that can delete my last char in the txt file ? I remember doing domething like that in C but it was years ago and I was beginning... 

Thanks for your help ! :)

Link to comment
Share on other sites

This should help you get started: StringTrimRight

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

There are many ways you can go about doing this. I like using the _FileReadToArray, depending on if you have a way to split the lines (otherwise just do FileOpen w/ overwrite, FileRead, StringTrimRight, FileWrite, FileClose), use the count, which would be under index 0, and trim the string as you see fit, then write the array back using _FileWriteFromArray with FileOpen in overwrite mode. 

Let me know if you have any questions, as there is multiple ways of going about achieving what you would like.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
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
 Share

×
×
  • Create New...