Jump to content

Save and Load .ini file


Recommended Posts

Can anyone assist me in this matter. I have not been able to figure out how to save information from a gui to a .ini file. I have it to where it tries to save it. but since i am running vista it tells me that i do not have permissions to save to that folder. Then i also need to know how to load that .ini file into the gui, and then when the Gui start it needs to load the last saved info into it.

If anyone can help me with this issue, that would be great.

Here is what i have so far:

#include <GuiConstantsEx.au3>

#include <TreeViewConstants.au3>

Opt('MustDeclareVars', 1)

Local $sFile = "BB16.ico"

Local $defaultstatus, $status, $filemenu, $fileitem, $helpmenu, $saveitem

Local $infoitem, $exititem, $recentfilesmenu, $separator1, $viewmenu

Local $viewstatusitem, $okbutton, $cancelbutton, $statuslabel, $msg, $file, $resetbutton

local $radio1, $radio2, $sellonly, $buyonly, $buyandsell, $tradeonly, $welcome

TraySetIcon ($sFile)

TraySetToolTip("Blackwater Bot")

; GUI

GuiCreate("Blackwater Bot", 1000, 750)

GUISetIcon($sFile)

; MENU

$filemenu = GUICtrlCreateMenu("File")

$fileitem = GUICtrlCreateMenuItem("Load Configuration", $filemenu)

$saveitem = GUICtrlCreateMenuItem("Save Current Configuration", $filemenu)

$separator1 = GUICtrlCreateMenuItem("", $filemenu, 2)

$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

GUICtrlSetState(-1, $GUI_CHECKED)

$okbutton = GUICtrlCreateButton("Launch", 440, 680, 80, 30)

GUICtrlSetState(-1, $GUI_FOCUS)

$cancelbutton = GUICtrlCreateButton("Cancel", 590, 680, 80, 30)

GUICtrlSetState(-1, $GUI_CHECKED)

$resetbutton = GUICtrlCreateButton("Reset", 280, 680, 80, 30)

GuiCtrlCreateGroup("Message Settings", 10, 10, 975, 375)

GuiCtrlCreateLabel("Welcome:", 13, 35)

$welcome = GUICtrlCreateInput("This is where you would put your welcome message.", 90, 30, 880, 20)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GuiCtrlCreateGroup("Settings", 10, 400, 475, 260)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

GuiCtrlCreateGroup("Settings", 510, 400, 475, 260)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

; GUI MESSAGE LOOP

GUISetState()

While 1

$msg = GUIGetMsg()

If $msg = $fileitem Then

$file = FileOpenDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")

If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)

EndIf

If $msg = $saveitem Then

$file = FileSaveDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")

If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)

EndIf

If $msg = $okbutton Then

ShellExecute ("C:\Program Files\Wizards of the Coast\Magic Online III\Renamer.exe", "", "C:\Program Files\Wizards of the Coast\Magic Online III")

GUISetState (@SW_HIDE)

If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)

EndIf

If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop

WEnd

GUIDelete()

Edited by BlackwaterBot
Link to comment
Share on other sites

You can use the registry because it's much reliable method if your program rely heavily on setting values. This way you don't need to care if the file exists or where it's located. If you choose to use the registry way you can try first to open it, if it fails then go with the default settings, otherwise the specific element is stored into it's corresponding variable instead of it's initial value.

If your .ini has many variable or setting to read/write this method is quite not as useful as parsing an ini file. In this case I believe the program need to come with .ini install file and install it whenever it's not where it's expected to be.

Link to comment
Share on other sites

OK, here is a closer look at my code. I have Most of the code for the GUI on here. Still some missing but most is here.

I still have the issue of saving, not sure if i have an issue loading the .ini file cause i have not had it create one YET. When i try to save it tells me that i dont have permision to save to the folder that i want it saved in.

My other question is the slider that i put in it. Is there a way to get a bubble to show me what the slider is on?

IF you see any other issues with the way i have this set up, just let me know.

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

Opt('MustDeclareVars', 1)

Local $sFile = "BB16.ico"
local $Auto, $BB, $Button1, $Button2, $Button3, $Buying, $Checkbox1
Local $Checkbox2, $Enough, $Group1, $Group2, $Group3, $Group4
Local $Input12, $Label13, $Label14, $Label15, $Label16, $Label17, $Label18, $Label19
Local $Label2, $Label20, $Label21, $Label22, $Label23, $Label24, $Label3, $Label4
Local $Label5, $Label6, $Label7, $Label8, $Label9, $Many, $MenuItem1, $MenuItem2
Local $MenuItem3, $MenuItem4, $Minute, $nMsg, $Radio1, $Radio2, $Radio3, $Radio4
Local $Selling, $sFile, $Slider1, $Take, $Thanks, $Tickets, $Unlock, $Waiting
Local $Welcome, $Label1, $Label10, $Label11, $Label12, $Input13, $msg, $fileitem
Local $saveitem, $file

TraySetIcon ($sFile)
GUICreate("Blackwater Bot", 1035, 607, 267, 160)
GUISetIcon($sFile)
GUICtrlSetState(-1, $GUI_FOCUS)
$Button1 = GUICtrlCreateButton("Cancel", 636, 536, 91, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Button2 = GUICtrlCreateButton("Launch", 480, 536, 91, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Button3 = GUICtrlCreateButton("Reset", 324, 536, 91, 25)
$Group1 = GUICtrlCreateGroup("Messages", 16, 8, 1009, 313)
$Label1 = GUICtrlCreateLabel("Welcome", 24, 32, 49, 17)
$Label2 = GUICtrlCreateLabel("Buying Balance", 24, 56, 78, 17)
$Label3 = GUICtrlCreateLabel("Selling Balance", 24, 80, 77, 17)
$Label4 = GUICtrlCreateLabel("Waiting for You", 24, 104, 77, 17)
$Label5 = GUICtrlCreateLabel("Too Many", 24, 128, 52, 17)
$Label6 = GUICtrlCreateLabel("Only Tickets", 24, 152, 63, 17)
$Label7 = GUICtrlCreateLabel("Not Enough", 24, 176, 61, 17)
$Label8 = GUICtrlCreateLabel("You Will Take", 24, 200, 71, 17)
$Label9 = GUICtrlCreateLabel("Thanks", 24, 224, 40, 17)
$Label10 = GUICtrlCreateLabel("Two Minnutes Left", 24, 248, 92, 17)
$Label11 = GUICtrlCreateLabel("Auto Answer", 24, 272, 64, 17)
$Welcome = GUICtrlCreateInput("Welcome", 128, 24, 881, 21)
$Buying = GUICtrlCreateInput("Buying Balance", 128, 48, 881, 21)
$Selling = GUICtrlCreateInput("Selling Balance", 128, 72, 881, 21)
$Waiting = GUICtrlCreateInput("Waiting for You", 128, 96, 881, 21)
$Many = GUICtrlCreateInput("Too Many", 128, 120, 881, 21)
$Tickets = GUICtrlCreateInput("Only Tickets", 128, 144, 881, 21)
$Enough = GUICtrlCreateInput("Not Enough", 128, 168, 881, 21)
$Take = GUICtrlCreateInput("You Will Take", 128, 192, 881, 21)
$Thanks = GUICtrlCreateInput("Thanks", 128, 216, 881, 21)
$Minute = GUICtrlCreateInput("Minute", 128, 240, 881, 21)
$Auto = GUICtrlCreateInput("Auto Answer", 128, 264, 881, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Settings", 13, 328, 497, 193)
$Label12 = GUICtrlCreateLabel("MTGO Account Name", 24, 352, 110, 17)
$Label13 = GUICtrlCreateLabel("MTGO Password", 24, 376, 85, 17)
$Input12 = GUICtrlCreateInput("Input12", 144, 344, 201, 21)
$Input13 = GUICtrlCreateInput("Input13", 144, 368, 201, 21)
$Group4 = GUICtrlCreateGroup("Mode", 352, 344, 145, 169)
$Radio1 = GUICtrlCreateRadio("Selling", 360, 368, 113, 17)
$Radio2 = GUICtrlCreateRadio("Buying", 360, 392, 113, 17)
$Radio3 = GUICtrlCreateRadio("Buying  Selling", 360, 416, 113, 17)
$Radio4 = GUICtrlCreateRadio("Trading", 360, 440, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Checkbox1 = GUICtrlCreateCheckbox("Take Screen Shot of ALL Trades", 24, 400, 209, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Take Screen Shot of ALL PM's", 24, 424, 185, 17)
$Label14 = GUICtrlCreateLabel("Trade Time", 24, 448, 58, 17)
$Slider1 = GUICtrlCreateSlider(96, 440, 150, 29)
GUICtrlSetLimit(-1, 30, 0)
$Label15 = GUICtrlCreateLabel("Unlock Code:", 24, 488, 69, 17)
$Unlock = GUICtrlCreateInput("Unlock Code", 96, 480, 241, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Prices", 525, 328, 497, 193)
$Label16 = GUICtrlCreateLabel("Commons:", 536, 368, 53, 17)
$Label17 = GUICtrlCreateLabel("Uncommons:", 536, 392, 66, 17)
$Label18 = GUICtrlCreateLabel("Rares:", 536, 416, 35, 17)
$Label19 = GUICtrlCreateLabel("Mythic:", 536, 440, 38, 17)
$Label20 = GUICtrlCreateLabel("Boosters:", 536, 464, 48, 17)
$Label21 = GUICtrlCreateLabel("BUYING", 656, 336, 61, 17)
$Label22 = GUICtrlCreateLabel("SELLING", 760, 336, 49, 17)
$Label23 = GUICtrlCreateLabel("TRADING", 864, 336, 53, 17)
$Label24 = GUICtrlCreateLabel("ALL Rates are PER 1 Ticket!!", 632, 488, 244, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem4 = GUICtrlCreateMenuItem("Load Configuration", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Save Configuration", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
#EndRegion ### END Koda GUI section ###

; GUI MESSAGE LOOP
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $MenuItem4 Then
            $file = FileOpenDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")
        EndIf
        If $msg = $MenuItem3 Then
            $file = FileSaveDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")
        EndIf
        If $msg = $Button2 Then
            ShellExecute ("C:\Program Files\Wizards of the Coast\Magic Online III\Renamer.exe", "", "C:\Program Files\Wizards of the Coast\Magic Online III") 
            GUISetState (@SW_HIDE)
        EndIf
        If $msg = $GUI_EVENT_CLOSE Or $msg = $Button1 Or $msg = $MenuItem2 Then ExitLoop
    WEnd
    GUIDelete()
Link to comment
Share on other sites

You can write your message loop like this:

While 1
    $msg = GUIGetMsg()

    Switch $msg
        Case $Slider1
            GUICtrlSetTip($Slider1, GUICtrlRead($Slider1))
        
        Case $MenuItem4
            $file = FileOpenDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")
    
        Case $MenuItem3
            $file = FileSaveDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")
        
        Case $Button2
            ShellExecute("C:\Program Files\Wizards of the Coast\Magic Online III\Renamer.exe", "", "C:\Program Files\Wizards of the Coast\Magic Online III")
            GUISetState(@SW_HIDE)
        Case $GUI_EVENT_CLOSE, $Button1, $MenuItem2
            ExitLoop
    EndSwitch
WEnd

Look at the GuiCtrlSetTip at the top of the switch, maybe that is what you've meant.

Regarding storing settings and values, what kind of data do you want to save?

Implementing this task either by the registry or an ini file is not suppose to be hard at all, please explain what sort of information you need to store.

Link to comment
Share on other sites

Regarding storing settings and values, what kind of data do you want to save?

Implementing this task either by the registry or an ini file is not suppose to be hard at all, please explain what sort of information you need to store.

This is for a Bot. It will be saving the configuration (Profile) of the bot. So it needs to save in the file that i have indicated so that it is easy for the user to find it. The info that it will be saving is all the data that is inputed into this GUI. I know that it TRIES to save, but it tells me that i done have permision to save it to that folder.

I haope that i have explained myself better this time.

Edited by BlackwaterBot
Link to comment
Share on other sites

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

Opt('MustDeclareVars', 1)

;Local $sFile = "BB16.ico"
Local $hGUI
local $Auto, $BB, $Button1, $Button2, $Button3, $Buying, $Checkbox1
Local $Checkbox2, $Enough, $Group1, $Group2, $Group3, $Group4
Local $Input12, $Label13, $Label14, $Label15, $Label16, $Label17, $Label18, $Label19
Local $Label2, $Label20, $Label21, $Label22, $Label23, $Label24, $Label3, $Label4
Local $Label5, $Label6, $Label7, $Label8, $Label9, $Many, $MenuItem1, $MenuItem2
Local $MenuItem3, $MenuItem4, $Minute, $nMsg, $Radio1, $Radio2, $Radio3, $Radio4
Local $Selling, $sFile, $Slider1, $Take, $Thanks, $Tickets, $Unlock, $Waiting
Local $Welcome, $Label1, $Label10, $Label11, $Label12, $Input13, $msg, $fileitem
Local $saveitem, $file

Local Enum $Wel, $Buy, $Sell, $Wait, $Mny, $Ticket, $Engh, $Tke, $Thx, $Min, $Aut, _
           $Inp12, $Inp13, $RadioN, $Ckbox1, $Ckbox2, $Sldr1, $Unlck
           
Local $avValues = _GetValues('HKLM\software\Blackwater Bot', 'Values')
If UBound($avValues) < 17 Then
    MsgBox(0x40, 'Error', 'bad error')
    Exit
EndIf

;TraySetIcon ($sFile)
$hGUI = GUICreate("Blackwater Bot", 1035, 607, 267, 160)
;GUISetIcon($sFile)
GUICtrlSetState(-1, $GUI_FOCUS)
$Button1 = GUICtrlCreateButton("Cancel", 636, 536, 91, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Button2 = GUICtrlCreateButton("Launch", 480, 536, 91, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Button3 = GUICtrlCreateButton("Reset", 324, 536, 91, 25)


#Region Start of Label region
$Group1 = GUICtrlCreateGroup("Messages", 16, 8, 1009, 313)
$Label1 = GUICtrlCreateLabel("Welcome", 24, 32, 49, 17)
$Label2 = GUICtrlCreateLabel("Buying Balance", 24, 56, 78, 17)
$Label3 = GUICtrlCreateLabel("Selling Balance", 24, 80, 77, 17)
$Label4 = GUICtrlCreateLabel("Waiting for You", 24, 104, 77, 17)
$Label5 = GUICtrlCreateLabel("Too Many", 24, 128, 52, 17)
$Label6 = GUICtrlCreateLabel("Only Tickets", 24, 152, 63, 17)
$Label7 = GUICtrlCreateLabel("Not Enough", 24, 176, 61, 17)
$Label8 = GUICtrlCreateLabel("You Will Take", 24, 200, 71, 17)
$Label9 = GUICtrlCreateLabel("Thanks", 24, 224, 40, 17)
$Label10 = GUICtrlCreateLabel("Two Minnutes Left", 24, 248, 92, 17)
$Label11 = GUICtrlCreateLabel("Auto Answer", 24, 272, 64, 17)
#EndRegion


#Region Start of inputs region
$Welcome = GUICtrlCreateInput($avValues[$Wel], 128, 24, 881, 21)
$Buying = GUICtrlCreateInput($avValues[$Buy], 128, 48, 881, 21)
$Selling = GUICtrlCreateInput($avValues[$Sell], 128, 72, 881, 21)
$Waiting = GUICtrlCreateInput($avValues[$Wait], 128, 96, 881, 21)
$Many = GUICtrlCreateInput($avValues[$Mny], 128, 120, 881, 21)
$Tickets = GUICtrlCreateInput($avValues[$Ticket], 128, 144, 881, 21)
$Enough = GUICtrlCreateInput($avValues[$Engh], 128, 168, 881, 21)
$Take = GUICtrlCreateInput($avValues[$Tke], 128, 192, 881, 21)
$Thanks = GUICtrlCreateInput($avValues[$Thx], 128, 216, 881, 21)
$Minute = GUICtrlCreateInput($avValues[$Min], 128, 240, 881, 21)
$Auto = GUICtrlCreateInput($avValues[$Aut], 128, 264, 881, 21)
#EndRegion


#Region Account and Password inputs region
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Settings", 13, 328, 497, 193)
$Label12 = GUICtrlCreateLabel("MTGO Account Name", 24, 352, 110, 17)
$Label13 = GUICtrlCreateLabel("MTGO Password", 24, 376, 85, 17)
$Input12 = GUICtrlCreateInput($avValues[$Inp12], 144, 344, 201, 21)
$Input13 = GUICtrlCreateInput($avValues[$Inp13], 144, 368, 201, 21)
#EndRegion


#Region Start of Mode radio group
$Group4 = GUICtrlCreateGroup("Mode", 352, 344, 145, 169)
$Radio1 = GUICtrlCreateRadio("Selling", 360, 368, 113, 17)
$Radio2 = GUICtrlCreateRadio("Buying", 360, 392, 113, 17)
$Radio3 = GUICtrlCreateRadio("Buying  Selling", 360, 416, 113, 17)
$Radio4 = GUICtrlCreateRadio("Trading", 360, 440, 113, 17)
GUICtrlSetState(Eval($avValues[$RadioN]), $GUI_CHECKED)
#EndRegion


#Region Start of CheckBoxes region
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Checkbox1 = GUICtrlCreateCheckbox("Take Screen Shot of ALL Trades", 24, 400, 209, 17)
GUICtrlSetState(-1, $avValues[$Ckbox1])
$Checkbox2 = GUICtrlCreateCheckbox("Take Screen Shot of ALL PM's", 24, 424, 185, 17)
GUICtrlSetState(-1, $avValues[$Ckbox2])
#EndRegion


#Region Start of Slider region
$Label14 = GUICtrlCreateLabel("Trade Time", 24, 448, 58, 17)
$Slider1 = GUICtrlCreateSlider(96, 440, 150, 29)
GUICtrlSetLimit(-1, 30, 0)
GUICtrlSetData($Slider1, $avValues[$Sldr1])
#EndRegion


#Region Start of Input region
$Label15 = GUICtrlCreateLabel("Unlock Code:", 24, 488, 69, 17)
$Unlock = GUICtrlCreateInput($avValues[$Unlck], 96, 480, 241, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion


#Region of Label region
$Group3 = GUICtrlCreateGroup("Prices", 525, 328, 497, 193)
$Label16 = GUICtrlCreateLabel("Commons:", 536, 368, 53, 17)
$Label17 = GUICtrlCreateLabel("Uncommons:", 536, 392, 66, 17)
$Label18 = GUICtrlCreateLabel("Rares:", 536, 416, 35, 17)
$Label19 = GUICtrlCreateLabel("Mythic:", 536, 440, 38, 17)
$Label20 = GUICtrlCreateLabel("Boosters:", 536, 464, 48, 17)
$Label21 = GUICtrlCreateLabel("BUYING", 656, 336, 61, 17)
$Label22 = GUICtrlCreateLabel("SELLING", 760, 336, 49, 17)
$Label23 = GUICtrlCreateLabel("TRADING", 864, 336, 53, 17)
$Label24 = GUICtrlCreateLabel("ALL Rates are PER 1 Ticket!!", 632, 488, 244, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion


#Region Start of Menu region
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem4 = GUICtrlCreateMenuItem("Load Configuration", $MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Save Configuration", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
#EndRegion


#EndRegion ### END Koda GUI section ###
GUISetState()

; GUI MESSAGE LOOP
 While 1
    $msg = GUIGetMsg()

    Switch $msg
        Case $Slider1
            GUICtrlSetTip($Slider1, GUICtrlRead($Slider1))
       
        Case $MenuItem4
            $file = FileOpenDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")
   
        Case $MenuItem3
            $file = FileSaveDialog("Choose file...", "C:\Program Files\Blackwater Bot", "All (*.ini)")
       
        Case $Button2
            ShellExecute("C:\Program Files\Wizards of the Coast\Magic Online III\Renamer.exe", "", "C:\Program Files\Wizards of the Coast\Magic Online III")
            GUISetState(@SW_HIDE)
        Case $GUI_EVENT_CLOSE, $Button1, $MenuItem2
            Local $iSave = MsgBox(0x43, 'Save changes', 'Do you want to exit and save changes?', 0, $hGUI)
            
            Switch $iSave
                Case 6 ; Yes
                    _SetValues('HKLM\software\Blackwater Bot', 'Values')
                    ContinueCase
                case 7 ; No
                    ExitLoop
            EndSwitch
    EndSwitch
WEnd


Func _GetValues($sKey, $sValue)
    Local $sString = RegRead($sKey, $sValue)
    Local $Chr = Chr(0xFF)
    
    If $sString <> "" Then
        Return StringSplit(BinaryToString($sString), $Chr, 2)
    Else
        $sString = "Welcome" & $Chr & "Buying Balance" & $Chr & "Selling Balance" & $Chr & _
                   "Waiting for You" & $Chr & "Too Many" & $Chr & "Only Tickets" & $Chr & _
                   "Not Enough" & $Chr & "You Will Take" & $Chr & "Thanks" & $Chr & "Minute" & $Chr & _
                   "Auto Answer" & $Chr & "Input12" & $Chr & "Input13" & $Chr & "Radio1" & $Chr & _
                   "4" & $Chr & "4" & $Chr & "0" & $Chr & "Unlock Code"; 4 for CheckBox $GUI_UNCHECKED
                                                                       ; 1 for CheckBox $GUI_CHECKED
                                                                       ; 0 slider value
                   
        RegWrite($sKey, $sValue, "REG_BINARY", StringToBinary($sString))
        
        Return StringSplit($sString, $Chr, 2)
    EndIf
EndFunc


Func _SetValues($sKey, $sValue)
    Local $sString = ''
    Local $Chr = Chr(0xFF)
    
    $sString = GUICtrlRead($Welcome) & $Chr
    $sString &= GUICtrlRead($Buying) & $Chr
    $sString &= GUICtrlRead($Selling) & $Chr
    $sString &= GUICtrlRead($Waiting) & $Chr
    $sString &= GUICtrlRead($Many) & $Chr
    $sString &= GUICtrlRead($Tickets) & $Chr
    $sString &= GUICtrlRead($Enough) & $Chr
    $sString &= GUICtrlRead($Take) & $Chr
    $sString &= GUICtrlRead($Thanks) & $Chr
    $sString &= GUICtrlRead($Minute) & $Chr
    $sString &= GUICtrlRead($Auto) & $Chr
    $sString &= GUICtrlRead($Input12) & $Chr
    $sString &= GUICtrlRead($Input13) & $Chr
    
    Select
        Case BitAND(GUICtrlRead($Radio1), $GUI_CHECKED)
            $sString &= 'Radio1' & $Chr
            
        Case BitAND(GUICtrlRead($Radio2), $GUI_CHECKED)
            $sString &= 'Radio2' & $Chr
            
        Case BitAND(GUICtrlRead($Radio3), $GUI_CHECKED)
            $sString &= 'Radio3' & $Chr
        
        Case BitAND(GUICtrlRead($Radio4), $GUI_CHECKED)
            $sString &= 'Radio4' & $Chr
            
        Case Else
            $sString &= 'Radio1' & $Chr
    EndSelect
    
    If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
        $sString &= '1' & $Chr
    Else
        $sString &= '4' & $Chr
    EndIf
    
    If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
        $sString &= '1' & $Chr
    Else
        $sString &= '4' & $Chr
    EndIf
    
    $sString &= GUICtrlRead($Slider1) & $Chr
    $sString &= GUICtrlRead($Unlock)
    
    RegWrite($sKey, $sValue, 'REG_BINARY', StringToBinary($sString))
EndFunc

Link to comment
Share on other sites

I thank you for redoing my code, but it still not saving the info. It still gives me the window saying that i do not have permision to save to the folder that is in there. Is this cause i am using Vista? cause i tried to save to the folder that is recomended and it still did not save it. I am so lost on this issue. I just want to thank you again Authenticity for all your help on this issue.

Link to comment
Share on other sites

That is for your first question. About Windows Vista permissions and why you can't save either way I can't help you sorry.

Try the #RequireAdmin, dunno if it will help.

OK, i got it to save...... but did not create a .ini file. If i changed things in the GUI and saved it would stay in the gui but did not create the .ini I will try that require admin thingy also. when i got it to save i did it with UAC turned off.

Link to comment
Share on other sites

If it's fine with the registry writing I don't think you need to care about ini file. Are you using account with administrators privilege?

I do need the .INI files cause if the user wants to use diffrent config files, then all they would have to do is load the .ini file instead of redoing everything in the bot every time they want to chage things.

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