Jump to content

input to iniwrite?


Recommended Posts

yeah i got board so i tried making a script that would help me write inis faster.. for some reason it wont read the input from the input boxs.. what did i do wroung i cant figure it out :whistle:

its probley something stupid

#include <GUIConstants.au3>
#include <Constants.au3>

Opt("GUIOnEventMode", 1)

Global $Group1, $Group2, $Group3, $Group4, $Input1, $Input2, $Input3, $Input4
Global $Button1, $ininame, $section, $key, $value,  $ini

$ini = GUICreate("Easy Ini Writer", 194, 274, 193, 115)
$Group1 = GUICtrlCreateGroup("Ini File Name", 8, 8, 177, 49)
    $Input1 = GUICtrlCreateInput("", 18, 26, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
     $ininame = @ScriptDir & "\" & GUICtrlRead($Input1) & ".ini"
$Group2 = GUICtrlCreateGroup("Section Name", 8, 64, 177, 49)
    $Input2 = GUICtrlCreateInput("", 18, 82, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $section = GUICtrlRead($Input2)
$Group3 = GUICtrlCreateGroup("Key name", 8, 120, 177, 49)
    $Input3 = GUICtrlCreateInput("", 18, 138, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $key = GUICtrlRead($Input3)
$Group4 = GUICtrlCreateGroup("Value", 8, 176, 177, 49)
    $Input4 = GUICtrlCreateInput("", 18, 194, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $value = GUICtrlRead($Input4)
$Button1 = GUICtrlCreateButton("Write Ini", 40, 232, 113, 33, 0)
    GUICtrlSetOnEvent(-1, "_ini")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $ini)
GUISetState()

While 1
    Sleep(2000)
WEnd
Func Terminate()
    Exit
EndFunc

Func _ini()
    IniWrite($ininame, $section, $key, $value)
    Sleep(200)
    Terminate()
EndFunc
Func OldWay()
    $inifile = ""
    $section = ""
    $key = ""
    $value = ""
    IniWrite($inifile, $section, $key, $value)
    ;ClipPut (" = IniRead(" & $inifilea & ", " & $sectiona & ", " & $key & ", " & $value &")")
EndFunc
Link to comment
Share on other sites

  • Developers

it will write the ini..

it wont write the values.

it doesnt read the input boxs

sry i was unclear

You need to do a GuiRead() just before writing to the INI file ... NOT before displaying the GUI...

:whistle:

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

kk

thanx! works now :whistle:

move to Example Scripts please :lmao:

#include <GUIConstants.au3>
#include <Constants.au3>

Opt("GUIOnEventMode", 1)

Global $Group1, $Group2, $Group3, $Group4, $Input1, $Input2, $Input3, $Input4
Global $Button1, $ininame, $section, $key, $value,  $ini

$ini = GUICreate("Easy Ini Writer", 194, 274, 193, 115)
$Group1 = GUICtrlCreateGroup("Ini File Name", 8, 8, 177, 49)
    $Input1 = GUICtrlCreateInput("", 18, 26, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)     
$Group2 = GUICtrlCreateGroup("Section Name", 8, 64, 177, 49)
    $Input2 = GUICtrlCreateInput("", 18, 82, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)    
$Group3 = GUICtrlCreateGroup("Key name", 8, 120, 177, 49)
    $Input3 = GUICtrlCreateInput("", 18, 138, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Value", 8, 176, 177, 49)
    $Input4 = GUICtrlCreateInput("", 18, 194, 161, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Write Ini", 40, 232, 113, 33, 0)
    GUICtrlSetOnEvent(-1, "_ini")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $ini)
GUISetState()

While 1
    Sleep(2000)
WEnd
Func Terminate()
    Exit
EndFunc

Func _ini()
    $ininame = @ScriptDir & "\" & GUICtrlRead($Input1) & ".ini"
    $section = GUICtrlRead($Input2)
    $key = GUICtrlRead($Input3)
    $value = GUICtrlRead($Input4)
    IniWrite($ininame, $section, $key, $value)
    Sleep(200)
    Terminate()
EndFunc
Edited by Golbez
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...