Jump to content

Recommended Posts

Posted

Hi !

In my script, users choose an exe file with FileOpenDialog.

I write the path and other info in an Ini file.

My problem : when I choose a file through FileOpenDialog, my Input control has this value, but when I save in Ini, there is nothing...

If I run my script, and when I complete path without FileOpenDialog, there is no problem...

SORRY for my poor English :(

Here is my script :( :

#include <GUIConstants.au3>

$account = IniRead("config.ini", "info", "account", "NotFound")
$password = IniRead("config.ini", "info", "password", "NotFound")
$wowexe_dir = IniRead("config.ini", "info", "wowexe_dir", "NotFound")

GUICreate("Config", "350", "200")

    GUICtrlCreateLabel("Account", 10, 12, 50)
    $new_acc = GUICtrlCreateInput($account, 70, 10, 100, 20)

    GUICtrlCreateLabel("Password", 10, 52, 50)
    $new_pass = GUICtrlCreateInput($password, 70, 50, 100, 20, $ES_PASSWORD)

    GUICtrlCreateLabel("WoW.exe", 10, 92, 50)
    $new_dir = GUICtrlCreateInput($wowexe_dir, 70, 90, 230, 20)

    $browse = GUICtrlCreateButton("...", 305, 90, 30, 20)
    $btn_save = GUICtrlCreateButton("Save", 50, 130, 100, 20)
    $btn_cnl = GUICtrlCreateButton("Cancel", 160, 130, 100, 20)

GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select      
        Case $msg = $btn_cnl
            exitloop
        Case $msg = $browse
            $TmpFile = FileOpenDialog("Choose file...",@DesktopDir,"Executable files (*.exe)")
            GUICtrlSetData($new_dir, $TmpFile);
        Case $msg = $btn_save
            IniWrite("config.ini", "info", "account", GUICtrlRead($new_acc))
            IniWrite("config.ini", "info", "password", GUICtrlRead($new_pass))
            IniWrite("config.ini", "info", "wowexe_dir", GUICtrlRead($new_dir))
            MsgBox(0, "Info saved", "Informations were saved in config");
    EndSelect
Wend

intrepid

Posted

works for me, only thing i changed was added location of ini:

IniWrite(@ScriptDir & "\config.ini", "info", "account", GUICtrlRead($new_acc))
            IniWrite(@ScriptDir & "\config.ini", "info", "password", GUICtrlRead($new_pass))
            IniWrite(@ScriptDir & "\config.ini", "info", "wowexe_dir", GUICtrlRead($new_dir))

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted

:(

When you run the script, you click on the button to choose an exe, you save, and open the ini, there is all tha path of the exe ???

becasue doesn't work for me ... :(

intrepid

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...