Sign in to follow this  
Followers 0
Golbez

input to iniwrite?

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

it will write the ini..

it wont write the values.

it doesnt read the input boxs

sry i was unclear

Edited by Golbez

Share this post


Link to post
Share on other sites

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:


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0