Jump to content
Sign in to follow this  

INI Help

Recommended Posts

Ok, I've been trying for a while.

I am trying to read an ini file and the file contains a path. What I want to do is replace a certain part of the path with another name but I can't figure out the correct thing String manipulation to use.

for instance,

$OldPath = C:\myfolder\inthe\year\2009\

$sOldPath = StringSplit($OldPath, "\", 1)

$IniVal= Iniread("C:\myfolder\myfile.ini\","Listing", "Path", "")
$nInifile = StringInStr($iniVal, "2008", 2)

If Not $sOldPath[5] = $nInifile Then

"The part I can't figure out here.  To replace the string in the Inifile to put 2009 where 2008 is in the Ini file Path."


Dont know if any of that makes since but I have a path just like C:\myfolder\inthe\year\2008\ in the ini file and want to replace it with a new value if the value of a folder is different. So instead of 2008, it will change the folder to 2009, based on the what it see when doing the comparison.

Edited by EndFunc

EndFuncAutoIt is the shiznit. I love it.

Share this post

Link to post
Share on other sites

Try this:

$IniVal = Iniread("C:\myfolder\myfile.ini\","Listing", "Path", "")
$iPos = StringInStr($IniVal, "2008")
If $iPos > 0 Then $IniVal = StringReplace($IniVal, "2008", "2009")

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...