Jump to content

_FileWriteToLine works except with numbers


zvvyt
 Share

Recommended Posts

Trying to make a program which will control another program by writing to an .ini file.

It all works great with letters, but when it's going to read from 3 dropdowns in the GUI and then write it, it gets the values but doesn't write it down.

#include <guiconstantsex.au3>
#include <WindowsConstants.au3>
#include <File.au3>

$gui = guicreate("Config",350,200)
;----------------Process name 1-------------------
$p1name = GUICtrlCreateInput(".exe",10,35,100)
;---------------Function 1----------------------
$p1list = GUICtrlCreateCombo("Shutdown",120,35,75)
GUICtrlSetData($p1list,"Run|Hide")
;----------------Wait time 1------------------------
$p1sleephourinput = GUICtrlCreateInput("0",215,35,35)
$p1sleephourupdown = GUICtrlCreateUpdown($p1sleephourinput)
GUICtrlSetLimit($p1sleephourupdown,24,0)
$p1sleepminuteinput = GUICtrlCreateInput("0",260,35,35)
$p1sleepminuteupdown = GUICtrlCreateUpdown($p1sleepminuteinput)
GUICtrlSetLimit($p1sleepminuteupdown,59,0)
$p1sleepsecondinput = GUICtrlCreateInput("0",305,35,35)
$p1sleepsecondupdown = GUICtrlCreateUpdown($p1sleepsecondinput)
GUICtrlSetLimit($p1sleepsecondupdown,59,0)
;-------------------Update----------------------------
$update = GUICtrlCreateButton("Update",150,150)
;-------------------Test------------------------------
;$test = GUICtrlCreateButton("Test",10,150)
;--------------------Groups---------------------------
GUICtrlCreateGroup("Process name",5,5,110,150)
;-----------------------------------------------------
guisetstate(@sw_show)
while 1
    $msg = GUIGetMsg()
    select 
    case $msg = $GUI_EVENT_CLOSE 
        Exit
    Case $msg = $GUI_EVENT_MINIMIZE
        GuiSetState(@SW_MINIMIZE)
;   case $msg = $test
;       $checkhour = GUICtrlRead($p1sleephourinput)
;       $checkminute = GUICtrlRead($p1sleepminuteinput)
;       $checksecond = GUICtrlRead($p1sleepsecondinput)
;-------------------File writing----------------------
    case $msg = $update
        $checkp1name = GUICtrlRead($p1name)
        $checkp1list = GUICtrlRead($p1list)
        $checkp1hour = GUICtrlRead($p1sleephourinput)
        $checkp1minute = GUICtrlRead($p1sleepminuteinput)
        $checkp1second = GUICtrlRead($p1sleepsecondinput)
        $time = $checkp1hour*3600+$checkp1minute*60+$checkp1second
        _FileWriteToLine("Config.ini",2,$checkp1name,1)
        _FileWriteToLine("Config.ini",3,$checkp1list,1)
        _FileWriteToLine("Config.ini",4,$time,1)            ;-----???
;------------------------------------------------------
    EndSelect
WEnd
Link to comment
Share on other sites

The String() function just converts something to a string. _FileWriteToLine() seems to like strings so that's what I did. As an example:

$a = 1
$b = 2
String($a + $b)

would output "3" and not 3. Also as a precaution when you read from this (if you read from it with another script) make sure to use Number() on the read data or String() on the data to compare it to.

Edit: Typo

Edited by dbzfanatic
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...