surreal Posted July 16, 2008 Share Posted July 16, 2008 ok, first i would like to say thanks for your help with this. i need to change just a part of the win.ini on our xp systems. the problem is that a lot of users win.ini are different, so the line numbers that i need to edit are always going to be different. example: ; for 16-bit app support [fonts] [extensions] [mci extensions] [files] [Mail] MAPI=1 CMC=1 CMCDLLNAME=mapi.dll CMCDLLNAME32=mapi32.dll MAPIX=1 MAPIXVER=1.0.0.1 OLEMessaging=1 [MCI Extensions.BAK] aif=MPEGVideo aifc=MPEGVideo aiff=MPEGVideo asf=MPEGVideo asx=MPEGVideo au=MPEGVideo [CKSN] winNT=open the part i need to change is the [mail] i would like to delete whatever they have and add my own entrys to everyone. is there a way to define just the [mail] part? if they have by chance a few [fonts] setting or [files] setting that changes the lines i need to edit. thanks again everyone for all your help... d@ve Link to comment Share on other sites More sharing options...
TehWhale Posted July 16, 2008 Share Posted July 16, 2008 (edited) IniReadSection() Would suit your needs. IniWrite() IniDelete() Edited July 16, 2008 by Alienware Link to comment Share on other sites More sharing options...
surreal Posted July 17, 2008 Author Share Posted July 17, 2008 that was easy enough thanks for the help, sorry for the lame question... IniDelete("C:\windows\win.ini", "mail") IniWrite("C:\windows\win.ini", "mail", "MAPI", "1") IniWrite("C:\windows\win.ini", "mail", "CMC", "1") IniWrite("C:\windows\win.ini", "mail", "CMCDLLNAME", "mapi.dll") IniWrite("C:\windows\win.ini", "mail", "CMCDLLNAME32", "mapi32.dll") IniWrite("C:\windows\win.ini", "mail", "MAPIX", "1") IniWrite("C:\windows\win.ini", "mail", "MAPIXVER", "1.0.0.1") IniWrite("C:\windows\win.ini", "mail", "OLEMessaging", "1") d@ve Link to comment Share on other sites More sharing options...
pete1234 Posted July 17, 2008 Share Posted July 17, 2008 You could also use variables, which would make it easier to make changes in the future. And you don't need the IniDelete $WinIniName = @WindowsDir & "\win.ini" $WinIniSection = "mail" IniWrite($WinIniName, $WinIniSection, "MAPI", "1") IniWrite($WinIniName, $WinIniSection, "CMC", "1") IniWrite($WinIniName, $WinIniSection, "CMCDLLNAME", "mapi.dll") IniWrite($WinIniName, $WinIniSection, "CMCDLLNAME32", "mapi32.dll") IniWrite($WinIniName, $WinIniSection, "MAPIX", "1") IniWrite($WinIniName, $WinIniSection, "MAPIXVER", "1.0.0.1") IniWrite($WinIniName, $WinIniSection, "OLEMessaging", "1") Link to comment Share on other sites More sharing options...
surreal Posted July 17, 2008 Author Share Posted July 17, 2008 thank you very much pete, that is very clean looking, thank you. Link to comment Share on other sites More sharing options...
surreal Posted July 17, 2008 Author Share Posted July 17, 2008 is it possable within the script to check before the it runs if the user in an admin to the system? d@ve Link to comment Share on other sites More sharing options...
James Posted July 17, 2008 Share Posted July 17, 2008 IsAdmin() Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
TehWhale Posted July 17, 2008 Share Posted July 17, 2008 You could also make sure that they have Admin by #RequireAdmin. Link to comment Share on other sites More sharing options...
surreal Posted July 17, 2008 Author Share Posted July 17, 2008 something like this? If Not IsAdmin() Then MsgBox(48, "Error", "You Are Not An Admin") exit EndIf d@ve Link to comment Share on other sites More sharing options...
James Posted July 17, 2008 Share Posted July 17, 2008 Yup! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
surreal Posted July 17, 2008 Author Share Posted July 17, 2008 i tested that, and it works great. thank you everyone for your help... d@ve 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