Jump to content

Recommended Posts

Posted

Can't get IniRenameSection to work.

http://www.autoitscript.com/autoit3/docs/functions/IniRenameSection.htm

My code is simply this:

IniRenameSection(@ScriptDir & "a.ini", "MySection", "MyNewSection")

file "a.ini" is in the same directory as script.

"[MySection]" is all that is inside of the INI file.

I even made a .exe and ran it as Administrator.

This is probably a simple error on my end i'm assuming.

Thx for the help

Posted

Folder macros do not include the trailing backslash

IniRenameSection(@ScriptDir & "a.ini", "MySection", "MyNewSection")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

I tried

IniRenameSection(@ScriptDir & "a.ini", "MySection", "MyNewSection")

and still not working

">"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersADMINDesktopautoitiniini 081212.au3"

>Exit code: 0 Time: 0.126" is what is keeps saying in autoit

Posted (edited)

:guitar: So, we are little Genie, I copied ur code and wrote a script and an INI file, gladly, it worked. Do you mind posting your INI file? We could see the error then.... :shifty:

The report looks good, check your INI file.

Edited by MKISH

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Posted

:guitar: So, we are little Genie, I copied ur code and wrote a script and an INI file, gladly, it worked. Do you mind posting your INI file? We could see the error then.... :shifty:

The report looks good, check your INI file.

Yea I already post it lol. the file is "a.ini" (in same dir as script) and File simply says
[MySection]
Posted

The INI file will say [MyNewSection] now. This is what this function is supposed to do.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Posted

You can't rename an empty section. Add a key and value to it and you will see that it works.

This will show you but remember that nothing will happen until after you close the first notepad window

$sIni = @ScriptDir & "a.ini"
IniWrite($sIni, "MySection", "Key", "Val")
RunWait("notepad.exe " & $sIni)
Sleep(1000)
IniRenameSection($sIni, "MySection", "MyNewSection")
Run("notepad.exe " & $sIni)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

The INI file will say [MyNewSection] now. This is what this function is supposed to do.

But it says MySection not MyNewSection

You can't rename an empty section. Add a key and value to it and you will see that it works.

This will show you but remember that nothing will happen until after you close the first notepad window

$sIni = @ScriptDir & "a.ini"
IniWrite($sIni, "MySection", "Key", "Val")
RunWait("notepad.exe " & $sIni)
Sleep(1000)
IniRenameSection($sIni, "MySection", "MyNewSection")
Run("notepad.exe " & $sIni)

LOL I knew it was something very simple. Thank you Geo
Posted

Glad to help.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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
  • Recently Browsing   0 members

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