Sign in to follow this  
Followers 0
ron

Find ini file and append a line

15 posts in this topic

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

Share this post


Link to post
Share on other sites



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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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?

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

I was looking through the scripts and scraps, many of those focused on a particular directory. Any tips on how to search all local drives for this file?

Share this post


Link to post
Share on other sites

search for drive in the helpfile, I'd say a for next loop based on $localdrives = DriveGetDrive("FIXED")


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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks, I will give it a try.

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

Thanks for everyones help the script is working great.

Share this post


Link to post
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
Sign in to follow this  
Followers 0