Jump to content

I have INIwrite problem


Recommended Posts

Before I ask u guys. I'm sorry I can't speak english.

I think I can't understand u. so Include screenshot under page. I hope understand you.

when someone put "01"(input1) and put "03"(input2) then checkbox1 checked. after this ini write

IniWrite("example.ini","General","Pc Name" , GUICtrlRead($input3) & GUICtrlRead($Input1)) is this correct?

I'm sorry. I'm really newby.. :) Help me~

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\input01.kxf
$Form1_1 = GUICreate("Form1", 324, 376, 320, 240)
$Input1 = GUICtrlCreateInput("PC start number", 32, 85, 113, 21)
$Input2 = GUICtrlCreateInput("PC last number", 172, 85, 113, 21)
$Input3 = GUICtrlCreateInput("PC name", 104, 24, 113, 21)
$Button1 = GUICtrlCreateButton("confirm", 32, 280, 81, 25)
$Button2 = GUICtrlCreateButton("cancle", 172, 280, 81, 25)
$Checkbox2 = GUICtrlCreateCheckbox("CONFIG2", 32, 115, 201, 17)
$Checkbox1 = GUICtrlCreateCheckbox("CONFIG1", 32, 55, 73, 17)
$Input4 = GUICtrlCreateInput("PC start number", 32, 145, 113, 21)
$Input5 = GUICtrlCreateInput("PC last number", 172, 145, 113, 21)
$Checkbox3 = GUICtrlCreateCheckbox("CONFIG3", 32, 175, 113, 17)
$Input6 = GUICtrlCreateInput("PC start number", 32, 205, 113, 21)
$Input7 = GUICtrlCreateInput("PC last number", 172, 205, 113, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = $GUI_EVENT_CLOSE
   Exit

  Case $msg = $Button2
   $Button2 = $GUI_EVENT_CLOSE
   Exit

  Case $msg = $Button1
  If GUICtrlRead($Input1) = 1 Then
  IniWrite("example.ini","General","Pc Name" , GUICtrlRead($input3) & GUICtrlRead($Input1))
EndIf
  EndSelect
  WEnd

form1.thumb.jpg.fa75e112f551901e42426924

how to make like this picture Iniwrite..

 

 

Link to comment
Share on other sites

Hey,

Is this what you're looking for?

I think i've understood what you're after.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\input01.kxf
$Form1_1 = GUICreate("Form1", 324, 376, 320, 240)
$Input1 = GUICtrlCreateInput("PC start number", 32, 85, 113, 21)
$Input2 = GUICtrlCreateInput("PC last number", 172, 85, 113, 21)
$Input3 = GUICtrlCreateInput("PC name", 104, 24, 113, 21)
$Button1 = GUICtrlCreateButton("confirm", 32, 280, 81, 25)
$Button2 = GUICtrlCreateButton("cancle", 172, 280, 81, 25)
$Checkbox2 = GUICtrlCreateCheckbox("CONFIG2", 32, 115, 201, 17)
$Checkbox1 = GUICtrlCreateCheckbox("CONFIG1", 32, 55, 73, 17)
$Input4 = GUICtrlCreateInput("PC start number", 32, 145, 113, 21)
$Input5 = GUICtrlCreateInput("PC last number", 172, 145, 113, 21)
$Checkbox3 = GUICtrlCreateCheckbox("CONFIG3", 32, 175, 113, 17)
$Input6 = GUICtrlCreateInput("PC start number", 32, 205, 113, 21)
$Input7 = GUICtrlCreateInput("PC last number", 172, 205, 113, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button2
            $Button2 = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button1
            $Data = ''
            if GUIctrlRead($CheckBox1) == $GUI_CHECKED Then $Data &= GUICtrlRead($input3) & GUICtrlRead($Input1)
            if GUIctrlRead($CheckBox2) == $GUI_CHECKED Then $Data &= GUICtrlRead($input3) & GUICtrlRead($Input4)
            if GUIctrlRead($CheckBox3) == $GUI_CHECKED Then $Data &= GUICtrlRead($input3) & GUICtrlRead($Input6)
            IniWrite("example.ini","General","Pc Name" , $Data)
    EndSelect
WEnd

Many Thanks

 

Javi

give a man an application, and he'll be frustrated for the day, Teach him how to program applications and he'll be frustrated for a lifetime.

Link to comment
Share on other sites

Try this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\input01.kxf
$Form1_1 = GUICreate("Form1", 324, 376, 320, 240)
$Input1 = GUICtrlCreateInput("PC start number", 32, 85, 113, 21)
$Input2 = GUICtrlCreateInput("PC last number", 172, 85, 113, 21)
$Input3 = GUICtrlCreateInput("PC name", 104, 24, 113, 21)
$Button1 = GUICtrlCreateButton("confirm", 32, 280, 81, 25)
$Button2 = GUICtrlCreateButton("cancle", 172, 280, 81, 25)
$Checkbox2 = GUICtrlCreateCheckbox("CONFIG2", 32, 115, 201, 17)
$Checkbox1 = GUICtrlCreateCheckbox("CONFIG1", 32, 55, 73, 17)
$Input4 = GUICtrlCreateInput("PC start number", 32, 145, 113, 21)
$Input5 = GUICtrlCreateInput("PC last number", 172, 145, 113, 21)
$Checkbox3 = GUICtrlCreateCheckbox("CONFIG3", 32, 175, 113, 17)
$Input6 = GUICtrlCreateInput("PC start number", 32, 205, 113, 21)
$Input7 = GUICtrlCreateInput("PC last number", 172, 205, 113, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button2
            $Button2 = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button1
            if GUIctrlRead($CheckBox1) == $GUI_CHECKED Then
                IniWrite("example.ini","CONFIG1","Pc Name" , GUICtrlRead($input3))
                IniWrite("example.ini","CONFIG1","PC start number" , $Input1)
                IniWrite("example.ini","CONFIG1","PC last number" , $Input2)
            EndIf
            if GUIctrlRead($CheckBox2) == $GUI_CHECKED Then
                IniWrite("example.ini","CONFIG2","Pc Name" , GUICtrlRead($input3))
                IniWrite("example.ini","CONFIG2","PC start number" , $Input4)
                IniWrite("example.ini","CONFIG2","PC last number" , $Input5)
            EndIf


            if GUIctrlRead($CheckBox3) == $GUI_CHECKED Then
                IniWrite("example.ini","CONFIG3","Pc Name" , GUICtrlRead($input3))
                IniWrite("example.ini","CONFIG3","PC start number" , $Input6)
                IniWrite("example.ini","CONFIG3","PC last number" , $Input7)
            EndIf

    EndSelect
WEnd

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

That would just mean you have to change the first input box (computer name) to what ever you want...If you want to use the same computer name for each configuration.

If that is not the case, just create another input box for each of the other configurations, and then change the $input1 for the right config to your new input variable.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Im sorry.. I could't understand ur explanation

how about this souce?

$ini = @ScriptDir & "\test.ini"
$key=1
For $value = 1 To 10 Step 1
    IniWriteSection($ini, "general " & $value, "")
 For $key = 1 To 10 Step 1
        IniWrite($ini, "Section " & $value, "Value" &$key, $key)
    Next
Next

If I use this souce

could u suggest more better souce for me?

Link to comment
Share on other sites

I am not sure what you are looking for. Can you show manually the format you are looking for with the INI file layout - with a couple of entries.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I think your logic might be wrong here. The PC NAME should be unique in the INI file?

[General] - has to be unique

key1 - the key can be only one, under each section name General, so your next section can also contain the key name
key2  = data - the data can be anything you want

WIKI INI FILE

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Maybe you can use this to get the idea?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\administrator\desktop\input01.kxf
$Form1_1 = GUICreate("Form1", 324, 376, 320, 240)
$Input1 = GUICtrlCreateInput("1", 32, 85, 113, 21)
$Input2 = GUICtrlCreateInput("3", 172, 85, 113, 21)
$Input3 = GUICtrlCreateInput("PC name", 104, 24, 113, 21)
$Button1 = GUICtrlCreateButton("confirm", 32, 280, 81, 25)
$Button2 = GUICtrlCreateButton("cancle", 172, 280, 81, 25)
$Checkbox2 = GUICtrlCreateCheckbox("CONFIG2", 32, 115, 201, 17)
$Checkbox1 = GUICtrlCreateCheckbox("CONFIG1", 32, 55, 73, 17)
$Input4 = GUICtrlCreateInput("4", 32, 145, 113, 21)
$Input5 = GUICtrlCreateInput("6", 172, 145, 113, 21)
$Checkbox3 = GUICtrlCreateCheckbox("CONFIG3", 32, 175, 113, 17)
$Input6 = GUICtrlCreateInput("7", 32, 205, 113, 21)
$Input7 = GUICtrlCreateInput("9", 172, 205, 113, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button2
            $Button2 = $GUI_EVENT_CLOSE
            Exit

        Case $msg = $Button1
            if GUIctrlRead($CheckBox1) == $GUI_CHECKED Then
                ; config 1
                For $x = GUICtrlRead($Input1) To GUICtrlRead($Input2)
                IniWrite("example.ini", "General" ,"Pc Name" & $x , '(config1)')
                Next
            EndIf
            if GUIctrlRead($CheckBox2) == $GUI_CHECKED Then
                ; config 2
               For $x = GUICtrlRead($Input4) To GUICtrlRead($Input5)
                IniWrite("example.ini", "General" ,"Pc Name" & $x , '(config2)')
                Next
            EndIf


            if GUIctrlRead($CheckBox3) == $GUI_CHECKED Then
                For $x = GUICtrlRead($Input6) To GUICtrlRead($Input7)
                IniWrite("example.ini", "General" ,"Pc Name" & $x , '(config3)')
                Next
            EndIf

    EndSelect
WEnd

 

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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