Jump to content

Find ini file and append a line


 Share

Recommended Posts

I need to find a file called notes.ini and append a line to the end of it. What would be the best way to do this if possible? The location could be different on every machine and the OS versions are 98 to XP....Help

Thanks

Link to comment
Share on other sites

  • Developers

What about checking Lotus.ini for the path to Notes:

[Lotus Applications]

Notes=c:\lotus\notes

I believe that this directory contains to Notes.ini... right ?

If so, a regread and filewriteline could do the trick .....

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

Link to comment
Share on other sites

Not all of our users will have the notes.ini installed in the same directory. Is it possible to use Regread to search the registry for the old Notes 5 keys and then reference that to find the notes.ini file?

Link to comment
Share on other sites

there's also a plethora of file find UDF's in scripts and scraps, you could use one of those to get the locations of all the notes.ini's on the hd, and then do a for next loop to edit them all?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

wouldn't it be easier to just read the registry for the directory that notes installed into and modify that file? I don't use notes here, so I can't get more detailed, but just do like JdeB suggests... I'm sure it'd be faster than searching all the drives for the notes.ini.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Not all of our users will have the notes.ini installed in the same directory.  Is it possible to use Regread to search the registry for the old Notes 5 keys and then reference that to find the notes.ini file?

This man wants to know how to search through the registry... Edited by SlimShady
Link to comment
Share on other sites

This man wants to know how to search through the registry...

:D thanks for pointing that out! if you know what the names of the keys are in the registry, you could have it check each of those locations with simple if then work... I don't know there's a way for autoit to literally search the whole registry... though someone could probably figure it out with the new(ish) RegEnumVal and RegEnumKey functions in the unstable build.

personally, I'd get the reg keys that I know exist, and get that info, check the info with a fileexists, then if that fails check the next possible reg key... that would likely be faster than searching the whole drive... I doubt that you'd have to check more than a few reg keys before finding the right one, and if you have a sample machine of each different notes install... that'd be your source for those keys...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

This is basically what I have come up with so far, since I am new it's a little rough. I am looking for the specific regkey below then if I find it I use that to find the notes.ini which I would like to append a value to. Once I append that value I want to launch a setup.exe file, which installs the Lotus notes client.... If the regkey specidied in the begining isn't found I want it to end with maybe a text pop-up saying contect the help desk. Any refinments or suggestions please?

$NotesReg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\5.0", "Path")

If $NotesReg = "Path" then; IniWrite("notes.ini", "[Notes]", "IM_NO_SETUP", "1")

elseif $NotesReg = "null" then; goto EndIf

Else = FileInstall("G:\ND6\ND65\ND65Client(all)\setup.exe")

EndIf

Edited by ron
Link to comment
Share on other sites

  • Developers

I guess you didn't run it yet .... :ph34r:

Here's a script to get you started...

$NotesReg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\5.0", "Path")
if @error then 
   msgbox(16,'Error', "call helpdesk ... Registry key not found ")
   Exit
EndIf
If FileExists($NotesReg  & "\notes.ini") then
   IniWrite($NotesReg  & "notes.ini", "[Notes]", "IM_NO_SETUP", "1")
   RunWait("G:\ND6\ND65\ND65Client(all)\setup.exe") ; run the setup from the G: drive
Else 
   msgbox(16,'Error', "call helpdesk .... Notes,ini not found")
EndIf

EDIT some code errors

Edited by JdeB

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

Link to comment
Share on other sites

I guess you didn't run it yet ....  :ph34r:

Here's a script to get you started...

$NotesReg = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes\5.0", "Path")
if @error then 
   msgbox(16,'Error', "call helpdesk ... Registry key not found ")
   Exit
EndIf
If FileExists($NotesReg  & "\notes.ini") then
   IniWrite($NotesReg  & "notes.ini", "[Notes]", "IM_NO_SETUP", "1")
   RunWait("G:\ND6\ND65\ND65Client(all)\setup.exe"); run the setup from the G: drive
Else 
   msgbox(16,'Error', "call helpdesk .... Notes,ini not found")
EndIf

EDIT some code errors

just noticed a little fix that's needed:

IniWrite($NotesReg  & "\notes.ini"

"I'm not even supposed to be here today!" -Dante (Hicks)

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