plankton Posted September 21, 2019 Share Posted September 21, 2019 Hi, my work requires tons of editing notepad, I have written my script to do so it has to open notepad and close it. My script requires run, winwaitactive and command send functions. Which all of this interrupt my desktop. I have to wait for it to finish and then continue my work. Sometime my script is gone wrong because I accidentally move my mouse. You can see that this is not efficient at all. If you know method how to edit file without opening the actual file. Please let me know. Thank you. Link to comment Share on other sites More sharing options...
alienclone Posted September 21, 2019 Share Posted September 21, 2019 for config files you should use ini iniread and iniwrite will work without needing to visibly open the file so it works in the background. or you can use fileopen, filewrite, fileclose If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
plankton Posted September 21, 2019 Author Share Posted September 21, 2019 5 minutes ago, alienclone said: for config files you should use ini iniread and iniwrite will work without needing to visibly open the file so it works in the background. or you can use fileopen, filewrite, fileclose But my files are not .ini file. They are just plain text.txt Does using file open, file write and close has to be visibly open? Link to comment Share on other sites More sharing options...
alienclone Posted September 21, 2019 Share Posted September 21, 2019 nope, they also work in the background If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
abberration Posted September 21, 2019 Share Posted September 21, 2019 Actually, iniwrite and iniread also work with file that have a .txt extension. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Musashi Posted September 22, 2019 Share Posted September 22, 2019 On 9/21/2019 at 3:35 AM, plankton said: Hi, my work requires tons of editing notepad, I have written my script to do so it has to open notepad and close it. My script requires run, winwaitactive and command send functions. Which all of this interrupt my desktop. I have to wait for it to finish and then continue my work. Sometime my script is gone wrong because I accidentally move my mouse. You can see that this is not efficient at all. If you know method how to edit file without opening the actual file. Please let me know. As you have noticed yourself, your workflow is not very efficient and unreliable too. @alienclone has already pointed you in the right direction : FileOpen, FileRead/Write, FileClose and so on. Can you give us a more detailed description of what you want to alter in the files ? A sample file would also be helpful (remove or replace confidential content with xxx if necessary). "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
plankton Posted September 24, 2019 Author Share Posted September 24, 2019 (edited) On 9/22/2019 at 2:20 PM, Musashi said: As you have noticed yourself, your workflow is not very efficient and unreliable too. @alienclone has already pointed you in the right direction : FileOpen, FileRead/Write, FileClose and so on. Can you give us a more detailed description of what you want to alter in the files ? A sample file would also be helpful (remove or replace confidential content with xxx if necessary). [file] host = xxx username = xxx1 pass = 36883688 dir = public_html/images file = test1.jpeg tmp = list1.jpeg passive = 1 debug = 0 auto = 0 local = 0 ssh = 0 I want to alter username, file and tmp which will go like xxx1, xxx2, xxx3.....xxx999. Same with file and tmp which will go like list1, list2, list3 untill list999. [file] host = xxx username = xxx2 pass = 36883688 dir = public_html/images file = test1.jpeg tmp = list1.jpeg passive = 1 debug = 0 auto = 0 local = 0 ssh = 0 Edited September 24, 2019 by plankton Link to comment Share on other sites More sharing options...
alienclone Posted September 24, 2019 Share Posted September 24, 2019 (edited) that IS actually the ini format even if they are stored in .txt files instead of .ini files, the iniread and iniwrite functions will work perfectly for your files. Edited September 24, 2019 by alienclone If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
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