Sign in to follow this  
Followers 0
vickerps

Problem With Script

5 posts in this topic

Can anyone figure out what going wrong here

If i enter some ini enteries into the edit box. The script will iniwrite them into the riva.ini. This work great aslong as riva.ini doesn't exist and it creates it.

If i update some ini enteries into riva.ini which exist. doing the same method the riva.ini includes a carrage return after every line.

; ----------------------------------------------------------------------------
; Declare our values
; ----------------------------------------------------------------------------
#include <file.au3>
#include <Funcs.au3>
#INCLUDE <process.au3>

$Customer =     "Ini updater"
Dim $data,$changes,$Inisplit

; ----------------------------------------------------------------------------
; GuiMenu Start
; ----------------------------------------------------------------------------
Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)
GuiCreate($Customer, 500,300,-1, 10 , 0x04CF0000)
WinActivate ( $Customer )

$Path =     GUISetControl("input", "", 90, 10, 350, 25)
        GUISetControl("label", "Path", 30, 10, 60, 20)

$Edit =     GUISetControl("edit", "", 90, 40, 400, 200)
        GUISetControl("label", "Update", 30, 40, 60, 20)
        
$Browse =   GUISetControl("button", "Browse", 450, 10, 40, 25)

$Update =   GUISetControl("button", "Update", 300, 250, 80, 40)

$exit =     GUISetControl("button", "Exit", 400, 250, 80, 40)

While 1

$N=GuiMsg ()

    IF $n =$browse THEN
    $inipath = FileOpenDialog("Choose a file", "", "ini file (*.ini)", 4)
    
    GuiWrite($path, 0, $inipath)
        
    ENDIF
    
SELECT 

Case $n = $Update
ExitLoop

Case $n = $exit
    Exit
 EndSelect
WEnd
GUIHide()  

FileWrite ( "temp.txt", guiread($Edit) )

_FileReadToArray( "temp.txt" , $changes )

    For $n = 1 to $changes[0]

    IF StringIsSpace ( $changes[$n] ) = 1 Then ContinueLoop
    
    StringStripWS ( $changes[$n], 3 )
    StringStripCR ( $changes[$n] )
        
        $headercheck= StringSplit ( $changes[$n], "[]" )
        
        If $headercheck[0] = 3 Then 

        $group = $headercheck[2]
        ContinueLoop
        
        Endif       
    
    $Inisplit=StringSplit ( $changes[$n], "=" )

IF $Inisplit[0] = 2 Then
IniWrite ( "riva.ini", $group, $Inisplit[1], $Inisplit[2])
Endif
    Next

FileDelete ( "temp.txt" )

ignore the inputbox haven't set that up yet

Share this post


Link to post
Share on other sites



FileWrite ( "temp.txt", guiread($Edit) )

Have you tried "GUICtrlRead" instead of guiread?

Share this post


Link to post
Share on other sites

this isnt correctly written code, this probaly is v2 code and should be posted there ut i really thing you should consider switching to v3

Share this post


Link to post
Share on other sites

this isnt correctly written code, this probaly is v2 code and should be posted there ut i really thing you should consider switching to v3

Obviously spoken by someone who has never seen v2 code. This is definitely not v2 but the commands are definitely screwy. I'd suggest going over your code and correcting some errors.

For example:

GUISetControl = GUICtrlCreateButton

$N=GuiMsg = $N=GUIGetMsg

There are more than I am willing to list and correct.

Share this post


Link to post
Share on other sites

Obviously spoken by someone who has never seen v2 code. This is definitely not v2 but the commands are definitely screwy. I'd suggest going over your code and correcting some errors.

For example:

GUISetControl = GUICtrlCreateButton

$N=GuiMsg = $N=GUIGetMsg

There are more than I am willing to list and correct.

hahhah exactly i just thought there was so many errors and syntax ive never seen that it was just old

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