Jump to content

How do you write or delete text in notepad configuration files?


plankton
 Share

Recommended Posts

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

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

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

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).

Musashi-C64.png

"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

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 by plankton
Link to comment
Share on other sites

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 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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...