Jump to content

Ini Editor


sandin
 Share

Recommended Posts

This is application is meant for creating or editing INI files (which all programmers use for saving their program's data)

Posted Image Posted Image Posted Image

You can add items (sections, keys, values), edit items, delete items, search for items or even drag items

Adding items is very simple, if your current selected item is Section, then if you click ADD, you'll add section with 1 key and it's value, If you click ADD while your current selection is any key, then you'll add a key with it's value in the same section where your selected key is.

Editing item's txt can be done with ENTER or F2 key (you can cancel with ESC while you're in "edit" mode)

Deleting items can be done with key DEL

You probably thinking "why did he used new child to set key's value it's annoying to expand every key to check/edit it's value", well if you turn TURBO mode on, then if you click ENTER while key item is selected, you go straight to edit it's value. And btw, I used new child to set as key's value so it could be easier to browse between keys and once you select Key or Value, bottom input will display the value, so you don't have to expand KEY if you wanna check it's value.

You can create AU3 code by clicking bottom button "Generate AU3 Code" which will generate writing of your INI file, or you can go Right Click on any item and select whether Write or Read code, and by that, application will generate AU3 code for writing or reading that key or value which is selected.

hotkeys:

CTRL+N = New

CTRL+O = Open

CTRL+S = Save

CTRL+SHIFT+S = Save As

CTRL+F = Find

ALT+A = Add item

Application Key (Next to Windows key) = call "right click menu" on treeview

I hope you'll like it and use it :)

Please report any bugs if you find.

Edit reason: fixed bug according to post #17 (thank you wraithdu) and added resizeable gui support according to wraithdu's suggestion (post #14) :)

Edit 2: Added ability to create descriptions for any of the items in the treeview according to titoproject's suggestion (post #12)

Edit 3: Fixed bug with "description of items", and reduced memory usage

Sample.txt

Ini_Editor.au3

Edited by sandin
Link to comment
Share on other sites

JamesBrooks made something called InsideNI which displays INI files in a tree just like this.

[center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]

Link to comment
Share on other sites

My first thought was this is going to be some simple stupid application. Then I saw "Sandin" as the thread creator, and I thought: "Dude this must be really advanced if he made it". Going to test it out now!

Edited by TehWhale
Link to comment
Share on other sites

I'm glad you do, creating ini files is not very hard even without a program, but if you need lots and lots and LOTS of data retrieved/written from/to an ini file, you could use an advanced application for the job, that was my case, so I made this tool :)

btw, main file replaced (fixed some dragging bugs - you can't move key if it's the only one in the section any more)

Edited by sandin
Link to comment
Share on other sites

Thanks for sharing! :)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Really nice script! Very well done.

I've got one request and one bug with your latest update. Would it be possible to allow your GUI to be resized? I know there's a ton of controls in there, so if it's a crazy amount of work, don't sweat it. Also, just a FYI, the @AutoItUnicode macro is gone in the 3.2.13.x betas, so I have to remove them to compile (no big deal either).

So the bug...I have a rogue icon when starting the app for about 5 seconds or so, then it disappears. In the screenshot I moved the GUI out of the way so you can see the icon, which means it's not part of the GUI somehow. This is new with the latest update.

EDIT - I also noticed the GUI is unresponsive (can't click buttons, exit, etc.) for those 5 seconds until the icon disappears.

Edited by wraithdu
Link to comment
Share on other sites

Ok, this happened with the first version also, I checked again. It has to do with the setTrans() function and Vista. PixelGetColor takes a CRAZY long time in Vista. It has something to do with the GetDC portion of the function, which it does each time it is called. I think you can get around this by calling the GetPixel function directly. I'll try to get you an fixed function (I had to do this before with the stereograms example some posted a while back).

Link to comment
Share on other sites

@billthecreator

Remove the references to it, and follow the code logic as if that macro is TRUE, because it is. It was removed from the 3.2.13.x betas because AutoIt is now Unicode only.

@sandin

This will fix the problem. BTW, I noticed in that function that you have a DllStruct that is never used, and had a type error in it 'inr' instead of 'int'. So I commented it out anyway. This should make your transparency work as expected. In your original, you were doing PixelGetColor() on the whole screen I believe (no specified window hwnd). This version fixes the performance problem in Vista, and specifies the $drag_gui, which I think is what you wanted anyway.

Func setTrans()
    Local $hGDI = DllOpen("gdi32.dll"), $color
    
    Local $hDC = _WinAPI_GetDC($drag_gui)
    $aM_Mask = DllCall($hGDI, "long", "CreateRectRgn", "long", 0, "long", 0, "long", $gw + 1, "long", $gh + 1)
;~     $rct = DllStructCreate("int;int;int;int", $aM_Mask[0])
    $TestCol = DllCall($hGDI, "int", "GetPixel", "hwnd", $hDC, "int", 0, "int", 0)
    $Startx = -1
    $Starty = -1
    $Endx = 0
    $Endy = 0
    For $i = 0 To $gw
        For $j = 0 To $gh
            $color = DllCall($hGDI, "int", "GetPixel", "hwnd", $hDC, "int", $i, "int", $j)
            If $color[0] = $TestCol[0] And $j < $gh Then
                If $Startx = -1 Then
                    $Startx = $i
                    $Starty = $j
                    $Endx = $i
                    $Endy = $j
                Else
                    $Endx = $i
                    $Endy = $j
                EndIf
            Else
                If $Startx <> -1 Then addRegion()
                $Startx = -1
                $Starty = -1
            EndIf
        Next
    Next
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $drag_gui, "long", $aM_Mask[0], "int", 1)
    _WinAPI_ReleaseDC($drag_gui, $hDC)
    DllClose($hGDI)
EndFunc
Edited by wraithdu
Link to comment
Share on other sites

Im not sure I understand. What should i do, for example, with this?

Func __GUICtrlRichEdit_LoadDLL()
    Switch @AutoItUnicode
        Case True
            $h_GUICtrlRTF_lib = DllCall("kernel32.dll", "hwnd", "LoadLibraryA", "str", "MSFTEDIT.DLL")
            If $h_GUICtrlRTF_lib[0] = 0 Then ContinueCase
            $_GRE_sRTFClassName = $RICHEDIT_CLASS50W
        Case False
            $h_GUICtrlRTF_lib = DllCall("kernel32.dll", "hwnd", "LoadLibraryA", "str", "RICHED20.DLL")
            If $h_GUICtrlRTF_lib[0] = 0 Then ContinueCase
            $_GRE_sRTFClassName = $RICHEDIT_CLASSA
            If @AutoItUnicode Then $_GRE_sRTFClassName = $RICHEDIT_CLASSW
        Case Else
            $h_GUICtrlRTF_lib = DllCall("kernel32.dll", "hwnd", "LoadLibraryA", "str", "RICHED32.DLL")
            If $h_GUICtrlRTF_lib[0] = 0 Then Exit 0 * MsgBox(32, @ScriptName & " - Error", "No RichEdit found. Exiting")
            $_GRE_sRTFClassName = $RICHEDIT_CLASS10A
    EndSwitch
EndFuncoÝ÷ Ù©Ýj[(¯zÜ(¢Ø^®ènW¦±«­¢+Ù}U%
Ñɱ  ÕÑѽ¹}MÑ%µ1¥ÍÐ ¤)}]¥¹A%}
±±]¥¹½ÝAɽ

they are undefinded

Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

@wraithdu:

thank you for your help, I've uploaded the script according to your settrans func. :)

I tried to make it resizable, but I ran into a prob. (treeview wasn't stretching, and neither was richedit - search input), though I'll try again :)

@billthecreator

try running the script with latest redistributable version (not beta) until I make it work for the beta.

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