Jump to content

Letters Writing as Numbers? (GUICtrlRead/IniWrite)


Recommended Posts

Hey guys,

Wasn't sure whether this would be a GUI or a general problem, so I chose to post it here.

I'm new to AutoIt (kind of), and can't figure this out - though I fear the answer will be embarrassingly simple.

For some reason, where Internet Explorer (or whatever) is meant to be written to the .ini, a number is.

I've tried changing the font (learning that the actual display doesn't seem to affect anything), and removed file extentions and spaces (learning that file extentions and spaces don't affect anything either).

Can any of you spot what the problem is?

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Local $ReadCombo4
Local $ReadCombo5

#region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Form1", 621, 219, 378, 248)
GUISetBkColor(0xFFFBF0)
$Combo4 = GUICtrlCreateCombo("Please select your browser title", 426, 113, 177, 25)
GUICtrlSetData(-1, "Mozilla Firefox|Internet Explorer|Google Chrome")
GUICtrlSetFont(-1, 8, 800, 0, "Calibri")
GUICtrlSetColor(-1, 0x000000)
$Combo5 = GUICtrlCreateCombo("Please select your browser file", 426, 138, 177, 25)
GUICtrlSetData(-1, "firefox.exe|iexplore.exe|chrome.exe")
GUICtrlSetFont(-1, 8, 800, 0, "Calibri")
GUICtrlSetColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Save", 262, 184, 97, 25, $WS_GROUP)
GUICtrlSetFont(-1, 8, 800, 0, "Calibri")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0x0066CC)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $ReadCombo4 = GUICtrlRead($Combo4)
            IniWrite(@ScriptDir & "\settings.ini", "Browser", "browser_title", $Combo4)
            $ReadCombo5 = GUICtrlRead($Combo5)
            IniWrite(@ScriptDir & "\settings.ini", "Browser", "browser_file", $Combo5)
    EndSwitch
WEnd

Sorry about the length of the code.

Thanks in advance,

Jordan.

Link to comment
Share on other sites

You're writing the control _handles_ instead of the control _contents_ (that you just read, btw):

$ReadCombo4 = GUICtrlRead($Combo4)
    IniWrite(@ScriptDir & "\settings.ini", "Browser", "browser_title", $Combo4)
    $ReadCombo5 = GUICtrlRead($Combo5)
    IniWrite(@ScriptDir & "\settings.ini", "Browser", "browser_file", $Combo5)

make it:

    $ReadCombo4 = GUICtrlRead($Combo4)
    IniWrite(@ScriptDir & "\settings.ini", "Browser", "browser_title", $ReadCombo4)
    $ReadCombo5 = GUICtrlRead($Combo5)
    IniWrite(@ScriptDir & "\settings.ini", "Browser", "browser_file", $ReadCombo5)

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

You're writing the control _handles_ instead of the control _contents_ (that you just read, btw):

It's late here.

I've just wasted a full hour with this.

I'm going to go lie down.

Thanks for the speedy reply and keen eye :mellow:

Link to comment
Share on other sites

No problem. BTW it's 4:30 AM here :mellow:

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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...