Jump to content

Iniread & Iniwrite


Markir
 Share

Recommended Posts

  • Developers

@Jdeb

How must  I write it, to read the ini file by starting the program?

$var = IniRead("C:\xpr_install2.ini", "Textinput", "Eintrag", '$file')

This code doesn't functioned

<{POST_SNAPBACK}>

$var = IniWrite("C:\xpr_install.ini", "Textinput", "Eintrag", "what you want when not found")

so $var will contain the value read.....

:lmao:

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I don't understand what you mean. Can you explain it a little bit easier?

<{POST_SNAPBACK}>

Here's a version that i assume you would like to do... Changed all variable used for ctrl handle to $h_??? to avoid confusion between the value of a control and the handle number.

Hope this helps :lmao:

#include <GUIConstants.au3>

If IniRead("C:\xpr_install.ini", "Checkbox", "Status", 'Disabled') = 'Disabled' Then
    $var = $GUI_UNCHECKED
Else
    $var = $GUI_CHECKED
EndIf

$file = IniRead("C:\xpr_install.ini", "Textinput", "Eintrag", "")

GUICreate("Ini-Test"); will create a dialog box that when displayed is centered

Opt ("GUICoordMode", 2)
Opt ("GUIOnEventMode", 1)

$h_checkCN = GUICtrlCreateCheckbox("CHECKBOX 1", 10, 10, 120, 20)
GUICtrlSetState($h_checkCN, $var)

$h_file = GUICtrlCreateInput($file, 10, 5, 100, 20)
GUICtrlSetState($h_file, $value);set the value

$ButtonReg_Import = GUICtrlCreateButton("  Import  ", 10, 30)
GUICtrlSetOnEvent(-1, "Reg_Import")

GUISetState()
While 1
    Sleep(10)
WEnd

Func Reg_Import()
    If GUICtrlRead($h_checkCN) = $GUI_CHECKED Then
        IniWrite("C:\xpr_install.ini", "Checkbox", "Status", 'Enabled')
    Else
        IniWrite("C:\xpr_install.ini", "Checkbox", "Status", 'Disabled')
    EndIf
    IniWrite("C:\xpr_install.ini", "Textinput", "Eintrag", GUICtrlRead($h_file))
EndFunc  ;==>Reg_Import
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hello JdeB,

thank you for your help, it is great to see how I get help here in this super forum. Can you help me by another iniwrite section?

I need the same with a combobox. I hope you can and want help me antoher time.

Thank you for everything

Link to comment
Share on other sites

  • Developers

Hello JdeB,

thank you for your help, it is great to see how I get help here in this super forum. Can you help me by another iniwrite section?

I need the same with a combobox. I hope you can and want help me antoher time.

Thank you for everything

<{POST_SNAPBACK}>

Would be happy to help but you need to explain what you want to do exactly and maybe post what you already have coded that doesn't work..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Ok, here is the code:

When the program was started, the following Code will be write down from me:

$file30 = IniRead("C:\uebersicht.ini", "Anschaltung", "Mail Server", "")

At the GUI there is the following Code:

GUICtrlCreateCombo ($file30,100,0,120)
$input30 = GUICtrlSetData(-1,"Exchange 5.5|Exchange 2000|Exchange2003|Lotus Notes 5|Lotus Notes 6|Lotus Notes 6.5", "")
GUICtrlSetState($input30, $file30)

Then I pressed the Button "Sichern"

$ButtonSichern = GUICtrlCreateButton("Sichern", 770, 35, 50)
GUICtrlSetOnEvent(-1, "Sichern")

The function "Sichern" will be called, and there is the following Code:

IniWrite("C:\uebersicht.ini", "Anschaltung", "Mail Server", GUICtrlRead($input30))

In the IniFile there is the following input:

[Anschaltung]Mail Server=0

When I start the program at a second time, the "0" will be displayed, but I want to have the "Exchange 5.5 or Exchange 2000 or Exchange2003 or Lotus Notes 5 or Lotus Notes 6 or Lotus Notes 6.5" what the user has searched for.

I hope that you know what I mean and the description is a little bit better.

Thank you for helping!

Link to comment
Share on other sites

  • Developers

Didn't test it but this looks wrong:

GUICtrlCreateCombo ($file30,100,0,120)
$input30 = GUICtrlSetData(-1,"Exchange 5.5|Exchange 2000|Exchange2003|Lotus Notes 5|Lotus Notes 6|Lotus Notes 6.5", "")
GUICtrlSetState($input30, $file30)

<{POST_SNAPBACK}>

Think that should be:

$input30 = GUICtrlCreateCombo ($file30,100,0,120)
GUICtrlSetData(-1,"Exchange 5.5|Exchange 2000|Exchange2003|Lotus Notes 5|Lotus Notes 6|Lotus Notes 6.5", $file30)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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