trynhyty Posted August 18, 2015 Posted August 18, 2015 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.exeAnyway, 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 !
MikahS Posted August 18, 2015 Posted August 18, 2015 This should help you get started: StringTrimRight Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
trynhyty Posted August 18, 2015 Author Posted August 18, 2015 This should help you get started: StringTrimRightThanks MikahS, So, if I understand, I have to read the whole .txt file as a string, remove 1 char from this string, and write the result in the .txt file ?
MikahS Posted August 18, 2015 Posted August 18, 2015 (edited) 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 August 18, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
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