Sign in to follow this  
Followers 0
dsisean

Saving and Writing Problem! HELP HELP

5 posts in this topic

I created a GUI that writes an INI file based on what you have entered in the GUI after pressing the SAVE button. when the program is rerun it will read the INI and populate the settings. The information passes correctly into the input boxes but when I try to change the value then click the SAVE button I do not get the value intended... I get 0. What am I doing wrong?

Here is the code:

;******************************************************************************
;**  Script: GUIT.au3 aka GUI TEST
;** -Designed to test the GUI functions to improve DSI scripting
;** Scripts using this:
;** ALL
;**
;*****************************************************************************
;
;#Include "Shared.au3"
;#Include "Define.au3"
#include <GUIConstants.au3> ;For GUI specific functions
#include <GUICombo.au3>
#include <array.au3>; for array functionality

#cs
******VARS
;**
;*****************************************************************************
#ce
;Tester Detail VARS
Dim $Tinitials ;testers initials
Dim $TDB    ;Test Database
Dim $Tappserver;Test application server
Dim $Tusername;Tester Username
Dim $Tpassword;Tester Password
Dim $TIarray;Tester Info array
Dim $TMarray;Test Module array
Dim $ORDarray;Order Array
Dim $TMVARarray;Variable Name collection for Test Modules

;Test Module Combo VARS
Dim $TpatDemo
Dim $Tsched
Dim $Tpcharge
Dim $Tppay
Dim $Treport
Dim $Tbilling
Dim $Tedi

;Test Module Order Combo VARS
Dim $Tordpat
Dim $Tordsched
Dim $Tordcharge
Dim $Tordpay
Dim $Tordreport
Dim $Tordbill
Dim $Tordedi

;Dim $Read1

;GUI VARS
Dim $Save   ;Save Button
Dim $Exit   ;Exit Button
Dim $msg    ;GUI Event Message
Dim $bfil = 0   ;File Ys/No

#cs
****************************************************************************
GUI (form) creation
****************************************************************************
#ce

GUICreate("DSI Load Tester", 400, 510)
CHKFile()
;Main Form Label

GuiCtrlCreateLabel("Load Tester for elligence 4.0", 100, 25, 160, 30, $SS_SIMPLE)

;PICTURE for GUI
GuiCtrlCreatePic("dsi.gif",0,0,53,62)
GuiCtrlSetColor(-1,0xffffff)

#cs
****************************************************************************
TESTER DETAILS GROUP
****************************************************************************
#ce
GuiCtrlCreateGroup("Tester's Details", 20, 70, 200, 150);start group

GuiCtrlCreateLabel("Tester Initials:", 25, 90, 160, 30, $SS_SIMPLE)
$Tinitials = GUICtrlCreateInput("", 125, 90, 30,18) ;Initials Input Box

If $bfil = 1 Then
$var = iniread("tester.ini", "Tester Details", "Tester Initials", "No")

;MsgBox(0,"1", $var)

$TInitials = $var
GUICtrlSetData(-1,$TInitials)
;MsgBox(0,"2", $Tinitials)
Else
EndIf

GuiCtrlCreateLabel("Tester DB:", 25, 115, 160, 30, $SS_SIMPLE)
$TDB = GUICtrlCreateInput("", 125, 115, 85,18)  ;DB Input Box

If $bfil = 1 Then
$TDB = iniread("tester.ini", "Tester Details", "Test Database", "No")
GUICtrlSetData(-1,$TDB)
Else
EndIf

GuiCtrlCreateLabel("App Server:", 25, 140, 160, 30, $SS_SIMPLE)
$Tappserver = GUICtrlCreateInput("", 125, 140, 85,18)   ;DB Input Box

If $bfil = 1 Then
$Tappserver = iniread("tester.ini", "Tester Details", "Test Application Server","No")
GUICtrlSetData(-1,$Tappserver)
Else
EndIf

GuiCtrlCreateLabel("Username:", 25, 165, 160, 30, $SS_SIMPLE)
$Tusername = GUICtrlCreateInput("", 125, 165, 85,18)    ;Username Input Box

If $bfil = 1 Then
$Tusername = iniread("tester.ini", "Tester Details", "Username", "No")
GUICtrlSetData(-1,$Tusername)
Else
EndIf

GuiCtrlCreateLabel("Password:", 25, 190, 160, 30, $SS_SIMPLE)
$Tpassword = GUICtrlCreateInput("", 125, 190, 85,18)    ;Username Input Box

If $bfil = 1 Then
$Tpassword = iniread("tester.ini", "Tester Details", "Password", "No")
GUICtrlSetData(-1,$Tpassword)
Else
EndIf

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

#cs
****************************************************************************
;TEST MODULES GROUP
****************************************************************************
#ce
GuiCtrlCreateGroup("Test Modules", 20, 220, 360, 250);start group

;Variable collection array
$TMVARarray = _arraycreate("$TpatDemo", "$Tordpat", "$Tsched", "$Tordsched", "$Tpcharge", "$Tordcharge", "$Tppay", "$Tordpay", "$Treport", "$Tordreport", "$Tbilling", "$Tordbill", "$Tedi", "$Tordedi")



GuiCtrlCreateLabel("Patient Demographics:", 25, 250, 160, 30, $SS_SIMPLE)
$TpatDemo = GUICtrlCreateCombo("Off", 140, 250, 90,10)  ;Patient Demo Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Patient Demographics such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All
#ce

If $bfil = 1 Then
$TpatDemo = iniread("tester.ini", "Test Module", "Patient Demographics", "No")
GUICtrlSetData(-1,$Tpatdemo)
Else
EndIf


GuiCtrlCreateLabel("Scheduling:", 25, 280, 160, 30, $SS_SIMPLE)
$Tsched = GUICtrlCreateCombo("Off", 140, 280, 90,10)    ;Scheduling Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Scheduling such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tsched = iniread("tester.ini", "Test Module", "Scheduling", "No")
GUICtrlSetData(-1,$Tsched)
Else
EndIf

GuiCtrlCreateLabel("Post Charges:", 25, 310, 160, 30, $SS_SIMPLE)
$Tpcharge = GUICtrlCreateCombo("Off", 140, 310, 90,10)  ;Post Charges Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Post Charges such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tpcharge = iniread("tester.ini", "Test Module", "Post Charge", "No")
GUICtrlSetData(-1,$Tpcharge)
Else
EndIf


GuiCtrlCreateLabel("Post Payments:", 25, 340, 160, 30, $SS_SIMPLE)
$Tppay = GUICtrlCreateCombo("Off", 140, 340, 90,10) ;Post Payment Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Post Payments such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tppay = iniread("tester.ini", "Test Module", "Post Payment", "No")
GUICtrlSetData(-1,$Tppay)
Else
EndIf


GuiCtrlCreateLabel("Reports:", 25, 370, 160, 30, $SS_SIMPLE)
$Treport = GUICtrlCreateCombo("Off", 140, 370, 90,10)   ;Report Combo Box
GUICtrlSetData(-1, "Daysheet|Daily Report|A/R|Superbills|Deposit Slips|Collector's Activity|Daily Run|Daily Run X 2|Daily Run X 3")
#cs 
This is where the selections for the Reports such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Treport = iniread("tester.ini", "Test Module", "Reports", "No")
GUICtrlSetData(-1,$Treport)
Else
EndIf


GuiCtrlCreateLabel("Billing:", 25, 400, 160, 30, $SS_SIMPLE)
$Tbilling = GUICtrlCreateCombo("Off", 140, 400, 90,10)  ;Report Combo Box
GUICtrlSetData(-1, "Statements|Ins Forms|Electronic|All Paper|Bill Insurance|ALL")
#cs 
This is where the selections for the Billing such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tbilling = iniread("tester.ini", "Test Module", "Billing","No")
GUICtrlSetData(-1,$Tbilling)
Else
EndIf


GuiCtrlCreateLabel("EDI:", 25, 430, 160, 30, $SS_SIMPLE)
$Tedi = GUICtrlCreateCombo("Off", 140, 430, 90,10)  ;Report Combo Box
GUICtrlSetData(-1, "ON")
#cs 
This is where the selections for the EDI such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tedi = iniread("tester.ini", "Test Module", "EDI", "No")
GUICtrlSetData(-1,$Tedi)
Else
EndIf


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

;ORDER GROUP
;func BuildOrd()
GuiCtrlCreateGroup("Order", 300, 230, 60, 230);start group

$ORDarray = _ArrayCreate(1,2,3,4,5,6,7);Order Selections


$Tordpat = GUICtrlCreateCombo("0", 310, 250, 30,10) ;ORDER COMBO for Patient Demo Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")


If $bfil = 1 Then
$Tordpat = iniread("tester.ini", "Test Module", "Pat Order", "No")

GUICtrlSetData(-1,$Tordpat)
Else
EndIf



$Tordsched = GUICtrlCreateCombo("0", 310, 280, 30,10)   ;ORDER COMBO for Scheduling Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordsched = iniread("tester.ini", "Test Module", "Sch Order", "No")
GUICtrlSetData(-1,$Tordsched)
Else
EndIf

$Tordcharge = GUICtrlCreateCombo("0", 310, 310, 30,10)  ;ORDER COMBO for Post Charges Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordcharge = iniread("tester.ini", "Test Module", "Chg Order", "No")
GUICtrlSetData(-1,$Tordcharge)
Else
EndIf


$Tordpay = GUICtrlCreateCombo("0", 310, 340, 30,10) ;ORDER COMBO for Post Payment Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordpay = iniread("tester.ini", "Test Module", "Pay Order", "No")
GUICtrlSetData(-1,$Tordpay)
Else
EndIf

$Tordreport = GUICtrlCreateCombo("0", 310, 370, 30,10)  ;ORDER COMBO for Report Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordreport = iniread("tester.ini", "Test Module", "Rpt Order", "No")
GUICtrlSetData(-1,$Tordreport)
Else
EndIf


$Tordbill = GUICtrlCreateCombo("0", 310, 400, 30,10)    ;ORDER COMBO for Billing Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordbill = iniread("tester.ini", "Test Module", "Bill Order", "No")
GUICtrlSetData(-1,$Tordbill)
Else
EndIf



$Tordedi = GUICtrlCreateCombo("0", 310, 430, 30,10) ;ORDER COMBO for EDI Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordedi = iniread("tester.ini", "Test Module", "EDI Order", "No")
GUICtrlSetData(-1,$Tordedi)
Else
EndIf


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

;SAVE BUTTON
$Save = GUICtrlCreateButton("&Save",150, 480, 30, 20)

;RUN SCRIPT BUTTON
$Run = GUICtrlCreateButton("&Run",200, 480, 30, 20)

;EXIT BUTTON
$Exit = GUICtrlCreateButton("E&xit",250, 480, 30, 20)

; GUI MESSAGE LOOP

GuiSetState()

;MsgBox (0,"3",  $Tinitials)

While 1 
    
    $msg = GuiGetMsg() 
    $TMarray = _arraycreate (GUICtrlRead($TpatDemo), GUICtrlRead($Tordpat), GUICtrlRead($Tsched), GUICtrlRead($Tordsched), GUICtrlRead($Tpcharge), GUICtrlRead($Tordcharge), GUICtrlRead($Tppay), GUICtrlRead($Tordpay), GUICtrlRead($Treport), GUICtrlRead($Tordreport), GUICtrlRead($Tbilling), GUICtrlRead($Tordbill), GUICtrlRead($Tedi), GUICtrlRead($Tordedi))
    $TIarray = _arraycreate (GUICtrlRead($Tinitials), GUICtrlRead($TDB), GUICtrlRead($Tappserver), GUICtrlRead($Tusername), GUICtrlRead($Tpassword))
    
    
    Select
        
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Save
    ;Saves settings in Tester.ini
    ;MsgBox(0,"prior to read", $Tinitials)
    ;MsgBox(0,"ctrl read of initials",GUICtrlRead($Tinitials))
    ;IniWrite("tester.ini", "Tester Details", "Tester Initials", GUICtrlRead($Tinitials))
        
        CreateINI1()
        
    Case $msg = $Run
    ;SetINI()
    ;MsgBox(0, "MIN VAL",_ArrayMin($TMarray,0, 0))
    ;MsgBox(0,"MAX VAL",_ArrayMax($TMarray,0,0))
    ;SetINI() WORKS
        _ArrayDisplay($TIarray, "TI Array")
        _ArrayDisplay($TMarray, "TM Array")
    ;Login($TIarray)
    ;DefinePatientDemographic(1)
    ;MsgBox(0, "Ubound of TIarray", Ubound($TIarray,1))
    Case $msg = $Exit

        ExitLoop
    EndSelect
    

WEnd
;check to see if false applies then reorders
;MsgBox (0,"2",  $Tinitials)

Func SetINI()
    Dim $i = 1
    
    $Read1 = IniReadSection("tester.ini", "Test Module")
    
    If @error Then
        
        MsgBox(4096, "", "Error occurred, probably no INI file.")

    Else
            For $i = 1 To $Read1[0][0];Ubound($Read1)
                
                    If $Read1[$i][1] = "Off" Then  
                        
                        
                        $Read1[$i+1][1] = "0"
                    ;IniWriteSection("tester.ini","Test Module",$Read1[$i]=0)
                        _ArrayDisplay($Read1, "Read if INI Array"& $i)
                        MsgBox(4096, "ON", "Key: " & $Read1[$i][0] & @CRLF & "Value: " & $Read1[$i][1])
                    ElseIf $i < UBound($Read1) Then
                        
                        _ArrayDisplay($Read1, "Read else INI Array"& $i)
                        MsgBox(4096, "OFF", "Key: " & $Read1[$i][0] & @CRLF & "Value: " & $Read1[$i][1])
                    Else
                    ;Do Nothing
                    EndIf
                    
            Next
            
        IniWriteSection("tester.ini", "Test Module", $Read1, 1) 
    EndIf
    

EndFunc

Func CreateINI1 ()
    
    
                

;Tester's Details
    
    $var = GUICtrlRead($Tinitials)

    MsgBox(0,"tinitials", GUICtrlRead($Tinitials))
    
    IniWrite("tester.ini", "Tester Details", "Tester Initials", $var)
;MsgBox(0,"tinitials", $Tinitials)
    
    IniWrite("tester.ini", "Tester Details", "Test Database", GUICtrlRead($TDB))
    
    
    IniWrite("tester.ini", "Tester Details", "Test Application Server", GUICtrlRead($Tappserver))
    
    
    IniWrite("tester.ini", "Tester Details", "Username", GUICtrlRead($Tusername))
    
    
    IniWrite("tester.ini", "Tester Details", "Password", GUICtrlRead($Tpassword))
    
;Test Module Selections
    
    IniWrite("tester.ini", "Test Module", "Patient Demographics", GUICtrlRead($TpatDemo))
    
    
    IniWrite("tester.ini", "Test Module", "Pat Order", GUICtrlRead($Tordpat)) 
    
    
    IniWrite("tester.ini", "Test Module", "Scheduling", GUICtrlRead($Tsched))
    
    
    IniWrite("tester.ini", "Test Module", "Sch Order", GUICtrlRead($Tordsched))
    
    
    IniWrite("tester.ini", "Test Module", "Post Charge", GUICtrlRead($Tpcharge))
    
    
    IniWrite("tester.ini", "Test Module", "Chg Order", GUICtrlRead($Tordcharge))
    
    
    IniWrite("tester.ini", "Test Module", "Post Payment", GUICtrlRead($Tppay))
    
    
    IniWrite("tester.ini", "Test Module", "Pay Order", GUICtrlRead($Tordpay))
    
    
    IniWrite("tester.ini", "Test Module", "Reports", GUICtrlRead($Treport))
    
    
    IniWrite("tester.ini", "Test Module", "Rpt Order", GUICtrlRead($Tordreport))
    
    
    IniWrite("tester.ini", "Test Module", "Billing", GUICtrlRead($Tbilling))
    
    
    IniWrite("tester.ini", "Test Module", "Bill Order", GUICtrlRead($Tordbill))
    
    
    IniWrite("tester.ini", "Test Module", "EDI", GUICtrlRead($Tedi))
    
    
    IniWrite("tester.ini", "Test Module", "EDI Order", GUICtrlRead($Tordedi))
    
    
    
    
    
    
EndFunc 

Func CHKFile()
    If FileExists("tester.ini") Then
        $bfil = 1
    Else
        $bfil = 0
    EndIf
    
EndFunc

Share this post


Link to post
Share on other sites

I created a GUI that writes an INI file based on what you have entered in the GUI after pressing the SAVE button. when the program is rerun it will read the INI and populate the settings. The information passes correctly into the input boxes but when I try to change the value then click the SAVE button I do not get the value intended... I get 0. What am I doing wrong?

Here is the code:

;******************************************************************************
;**  Script: GUIT.au3 aka GUI TEST
;** -Designed to test the GUI functions to improve DSI scripting
;** Scripts using this:
;** ALL
;**
;*****************************************************************************
;
;#Include "Shared.au3"
;#Include "Define.au3"
#include <GUIConstants.au3>;For GUI specific functions
#include <GUICombo.au3>
#include <array.au3>; for array functionality

#cs
******VARS
;**
;*****************************************************************************
#ce
;Tester Detail VARS
Dim $Tinitials;testers initials
Dim $TDB;Test Database
Dim $Tappserver;Test application server
Dim $Tusername;Tester Username
Dim $Tpassword;Tester Password
Dim $TIarray;Tester Info array
Dim $TMarray;Test Module array
Dim $ORDarray;Order Array
Dim $TMVARarray;Variable Name collection for Test Modules

;Test Module Combo VARS
Dim $TpatDemo
Dim $Tsched
Dim $Tpcharge
Dim $Tppay
Dim $Treport
Dim $Tbilling
Dim $Tedi

;Test Module Order Combo VARS
Dim $Tordpat
Dim $Tordsched
Dim $Tordcharge
Dim $Tordpay
Dim $Tordreport
Dim $Tordbill
Dim $Tordedi

;Dim $Read1

;GUI VARS
Dim $Save;Save Button
Dim $Exit;Exit Button
Dim $msg;GUI Event Message
Dim $bfil = 0;File Ys/No

#cs
****************************************************************************
GUI (form) creation
****************************************************************************
#ce

GUICreate("DSI Load Tester", 400, 510)
CHKFile()
;Main Form Label

GuiCtrlCreateLabel("Load Tester for elligence 4.0", 100, 25, 160, 30, $SS_SIMPLE)

;PICTURE for GUI
GuiCtrlCreatePic("dsi.gif",0,0,53,62)
GuiCtrlSetColor(-1,0xffffff)

#cs
****************************************************************************
TESTER DETAILS GROUP
****************************************************************************
#ce
GuiCtrlCreateGroup("Tester's Details", 20, 70, 200, 150);start group

GuiCtrlCreateLabel("Tester Initials:", 25, 90, 160, 30, $SS_SIMPLE)
$Tinitials = GUICtrlCreateInput("", 125, 90, 30,18);Initials Input Box

If $bfil = 1 Then
$var = iniread("tester.ini", "Tester Details", "Tester Initials", "No")

;MsgBox(0,"1", $var)

$TInitials = $var
GUICtrlSetData(-1,$TInitials)
;MsgBox(0,"2", $Tinitials)
Else
EndIf

GuiCtrlCreateLabel("Tester DB:", 25, 115, 160, 30, $SS_SIMPLE)
$TDB = GUICtrlCreateInput("", 125, 115, 85,18);DB Input Box

If $bfil = 1 Then
$TDB = iniread("tester.ini", "Tester Details", "Test Database", "No")
GUICtrlSetData(-1,$TDB)
Else
EndIf

GuiCtrlCreateLabel("App Server:", 25, 140, 160, 30, $SS_SIMPLE)
$Tappserver = GUICtrlCreateInput("", 125, 140, 85,18);DB Input Box

If $bfil = 1 Then
$Tappserver = iniread("tester.ini", "Tester Details", "Test Application Server","No")
GUICtrlSetData(-1,$Tappserver)
Else
EndIf

GuiCtrlCreateLabel("Username:", 25, 165, 160, 30, $SS_SIMPLE)
$Tusername = GUICtrlCreateInput("", 125, 165, 85,18);Username Input Box

If $bfil = 1 Then
$Tusername = iniread("tester.ini", "Tester Details", "Username", "No")
GUICtrlSetData(-1,$Tusername)
Else
EndIf

GuiCtrlCreateLabel("Password:", 25, 190, 160, 30, $SS_SIMPLE)
$Tpassword = GUICtrlCreateInput("", 125, 190, 85,18);Username Input Box

If $bfil = 1 Then
$Tpassword = iniread("tester.ini", "Tester Details", "Password", "No")
GUICtrlSetData(-1,$Tpassword)
Else
EndIf

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

#cs
****************************************************************************
;TEST MODULES GROUP
****************************************************************************
#ce
GuiCtrlCreateGroup("Test Modules", 20, 220, 360, 250);start group

;Variable collection array
$TMVARarray = _arraycreate("$TpatDemo", "$Tordpat", "$Tsched", "$Tordsched", "$Tpcharge", "$Tordcharge", "$Tppay", "$Tordpay", "$Treport", "$Tordreport", "$Tbilling", "$Tordbill", "$Tedi", "$Tordedi")
GuiCtrlCreateLabel("Patient Demographics:", 25, 250, 160, 30, $SS_SIMPLE)
$TpatDemo = GUICtrlCreateCombo("Off", 140, 250, 90,10);Patient Demo Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Patient Demographics such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All
#ce

If $bfil = 1 Then
$TpatDemo = iniread("tester.ini", "Test Module", "Patient Demographics", "No")
GUICtrlSetData(-1,$Tpatdemo)
Else
EndIf
GuiCtrlCreateLabel("Scheduling:", 25, 280, 160, 30, $SS_SIMPLE)
$Tsched = GUICtrlCreateCombo("Off", 140, 280, 90,10);Scheduling Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Scheduling such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tsched = iniread("tester.ini", "Test Module", "Scheduling", "No")
GUICtrlSetData(-1,$Tsched)
Else
EndIf

GuiCtrlCreateLabel("Post Charges:", 25, 310, 160, 30, $SS_SIMPLE)
$Tpcharge = GUICtrlCreateCombo("Off", 140, 310, 90,10);Post Charges Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Post Charges such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tpcharge = iniread("tester.ini", "Test Module", "Post Charge", "No")
GUICtrlSetData(-1,$Tpcharge)
Else
EndIf
GuiCtrlCreateLabel("Post Payments:", 25, 340, 160, 30, $SS_SIMPLE)
$Tppay = GUICtrlCreateCombo("Off", 140, 340, 90,10);Post Payment Combo Box
GUICtrlSetData(-1, "Top 5|Top 20|Top 50|Bottom 5|Bottom 20|Bottom 50|ALL")
#cs 
This is where the selections for the Post Payments such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tppay = iniread("tester.ini", "Test Module", "Post Payment", "No")
GUICtrlSetData(-1,$Tppay)
Else
EndIf
GuiCtrlCreateLabel("Reports:", 25, 370, 160, 30, $SS_SIMPLE)
$Treport = GUICtrlCreateCombo("Off", 140, 370, 90,10);Report Combo Box
GUICtrlSetData(-1, "Daysheet|Daily Report|A/R|Superbills|Deposit Slips|Collector's Activity|Daily Run|Daily Run X 2|Daily Run X 3")
#cs 
This is where the selections for the Reports such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Treport = iniread("tester.ini", "Test Module", "Reports", "No")
GUICtrlSetData(-1,$Treport)
Else
EndIf
GuiCtrlCreateLabel("Billing:", 25, 400, 160, 30, $SS_SIMPLE)
$Tbilling = GUICtrlCreateCombo("Off", 140, 400, 90,10);Report Combo Box
GUICtrlSetData(-1, "Statements|Ins Forms|Electronic|All Paper|Bill Insurance|ALL")
#cs 
This is where the selections for the Billing such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tbilling = iniread("tester.ini", "Test Module", "Billing","No")
GUICtrlSetData(-1,$Tbilling)
Else
EndIf
GuiCtrlCreateLabel("EDI:", 25, 430, 160, 30, $SS_SIMPLE)
$Tedi = GUICtrlCreateCombo("Off", 140, 430, 90,10);Report Combo Box
GUICtrlSetData(-1, "ON")
#cs 
This is where the selections for the EDI such as: 
1.  First 10 (records/patients)  2.  First 50  3. Last 10 4. Last 50  5. All  
#ce
;CheckINI1 ($Tinitials, $TDB, $Tappserver, $Tusername, $Tpassword, $TpatDemo, $Tsched, $Tpcharge, $Tppay, $Treport, $Tbilling, $Tedi, $Tordpat, $Tordsched, $Tordcharge, $Tordpay, $Tordreport, $Tordbill, $Tordedi) 

If $bfil = 1 Then
$Tedi = iniread("tester.ini", "Test Module", "EDI", "No")
GUICtrlSetData(-1,$Tedi)
Else
EndIf
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group

;ORDER GROUP
;func BuildOrd()
GuiCtrlCreateGroup("Order", 300, 230, 60, 230);start group

$ORDarray = _ArrayCreate(1,2,3,4,5,6,7);Order Selections
$Tordpat = GUICtrlCreateCombo("0", 310, 250, 30,10);ORDER COMBO for Patient Demo Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")
If $bfil = 1 Then
$Tordpat = iniread("tester.ini", "Test Module", "Pat Order", "No")

GUICtrlSetData(-1,$Tordpat)
Else
EndIf
$Tordsched = GUICtrlCreateCombo("0", 310, 280, 30,10);ORDER COMBO for Scheduling Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordsched = iniread("tester.ini", "Test Module", "Sch Order", "No")
GUICtrlSetData(-1,$Tordsched)
Else
EndIf

$Tordcharge = GUICtrlCreateCombo("0", 310, 310, 30,10);ORDER COMBO for Post Charges Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordcharge = iniread("tester.ini", "Test Module", "Chg Order", "No")
GUICtrlSetData(-1,$Tordcharge)
Else
EndIf
$Tordpay = GUICtrlCreateCombo("0", 310, 340, 30,10);ORDER COMBO for Post Payment Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordpay = iniread("tester.ini", "Test Module", "Pay Order", "No")
GUICtrlSetData(-1,$Tordpay)
Else
EndIf

$Tordreport = GUICtrlCreateCombo("0", 310, 370, 30,10);ORDER COMBO for Report Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordreport = iniread("tester.ini", "Test Module", "Rpt Order", "No")
GUICtrlSetData(-1,$Tordreport)
Else
EndIf
$Tordbill = GUICtrlCreateCombo("0", 310, 400, 30,10);ORDER COMBO for Billing Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordbill = iniread("tester.ini", "Test Module", "Bill Order", "No")
GUICtrlSetData(-1,$Tordbill)
Else
EndIf
$Tordedi = GUICtrlCreateCombo("0", 310, 430, 30,10);ORDER COMBO for EDI Combo Box
GUICtrlSetData(-1, "1|2|3|4|5|6|7","0")

If $bfil = 1 Then
$Tordedi = iniread("tester.ini", "Test Module", "EDI Order", "No")
GUICtrlSetData(-1,$Tordedi)
Else
EndIf
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group
;EndFunc

;SAVE BUTTON
$Save = GUICtrlCreateButton("&Save",150, 480, 30, 20)

;RUN SCRIPT BUTTON
$Run = GUICtrlCreateButton("&Run",200, 480, 30, 20)

;EXIT BUTTON
$Exit = GUICtrlCreateButton("E&xit",250, 480, 30, 20)

; GUI MESSAGE LOOP

GuiSetState()

;MsgBox (0,"3",  $Tinitials)

While 1 
    
    $msg = GuiGetMsg() 
    $TMarray = _arraycreate (GUICtrlRead($TpatDemo), GUICtrlRead($Tordpat), GUICtrlRead($Tsched), GUICtrlRead($Tordsched), GUICtrlRead($Tpcharge), GUICtrlRead($Tordcharge), GUICtrlRead($Tppay), GUICtrlRead($Tordpay), GUICtrlRead($Treport), GUICtrlRead($Tordreport), GUICtrlRead($Tbilling), GUICtrlRead($Tordbill), GUICtrlRead($Tedi), GUICtrlRead($Tordedi))
    $TIarray = _arraycreate (GUICtrlRead($Tinitials), GUICtrlRead($TDB), GUICtrlRead($Tappserver), GUICtrlRead($Tusername), GUICtrlRead($Tpassword))
    
    
    Select
        
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Save
;Saves settings in Tester.ini
;MsgBox(0,"prior to read", $Tinitials)
;MsgBox(0,"ctrl read of initials",GUICtrlRead($Tinitials))
;IniWrite("tester.ini", "Tester Details", "Tester Initials", GUICtrlRead($Tinitials))
        
        CreateINI1()
        
    Case $msg = $Run
;SetINI()
;MsgBox(0, "MIN VAL",_ArrayMin($TMarray,0, 0))
;MsgBox(0,"MAX VAL",_ArrayMax($TMarray,0,0))
;SetINI() WORKS
        _ArrayDisplay($TIarray, "TI Array")
        _ArrayDisplay($TMarray, "TM Array")
;Login($TIarray)
;DefinePatientDemographic(1)
;MsgBox(0, "Ubound of TIarray", Ubound($TIarray,1))
    Case $msg = $Exit

        ExitLoop
    EndSelect
    

WEnd
;check to see if false applies then reorders
;MsgBox (0,"2",  $Tinitials)

Func SetINI()
    Dim $i = 1
    
    $Read1 = IniReadSection("tester.ini", "Test Module")
    
    If @error Then
        
        MsgBox(4096, "", "Error occurred, probably no INI file.")

    Else
            For $i = 1 To $Read1[0][0];Ubound($Read1)
                
                    If $Read1[$i][1] = "Off" Then  
                        
                        
                        $Read1[$i+1][1] = "0"
                ;IniWriteSection("tester.ini","Test Module",$Read1[$i]=0)
                        _ArrayDisplay($Read1, "Read if INI Array"& $i)
                        MsgBox(4096, "ON", "Key: " & $Read1[$i][0] & @CRLF & "Value: " & $Read1[$i][1])
                    ElseIf $i < UBound($Read1) Then
                        
                        _ArrayDisplay($Read1, "Read else INI Array"& $i)
                        MsgBox(4096, "OFF", "Key: " & $Read1[$i][0] & @CRLF & "Value: " & $Read1[$i][1])
                    Else
                ;Do Nothing
                    EndIf
                    
            Next
            
        IniWriteSection("tester.ini", "Test Module", $Read1, 1) 
    EndIf
    

EndFunc

Func CreateINI1 ()
    
    
                

;Tester's Details
    
    $var = GUICtrlRead($Tinitials)

    MsgBox(0,"tinitials", GUICtrlRead($Tinitials))
    
    IniWrite("tester.ini", "Tester Details", "Tester Initials", $var)
;MsgBox(0,"tinitials", $Tinitials)
    
    IniWrite("tester.ini", "Tester Details", "Test Database", GUICtrlRead($TDB))
    
    
    IniWrite("tester.ini", "Tester Details", "Test Application Server", GUICtrlRead($Tappserver))
    
    
    IniWrite("tester.ini", "Tester Details", "Username", GUICtrlRead($Tusername))
    
    
    IniWrite("tester.ini", "Tester Details", "Password", GUICtrlRead($Tpassword))
    
;Test Module Selections
    
    IniWrite("tester.ini", "Test Module", "Patient Demographics", GUICtrlRead($TpatDemo))
    
    
    IniWrite("tester.ini", "Test Module", "Pat Order", GUICtrlRead($Tordpat)) 
    
    
    IniWrite("tester.ini", "Test Module", "Scheduling", GUICtrlRead($Tsched))
    
    
    IniWrite("tester.ini", "Test Module", "Sch Order", GUICtrlRead($Tordsched))
    
    
    IniWrite("tester.ini", "Test Module", "Post Charge", GUICtrlRead($Tpcharge))
    
    
    IniWrite("tester.ini", "Test Module", "Chg Order", GUICtrlRead($Tordcharge))
    
    
    IniWrite("tester.ini", "Test Module", "Post Payment", GUICtrlRead($Tppay))
    
    
    IniWrite("tester.ini", "Test Module", "Pay Order", GUICtrlRead($Tordpay))
    
    
    IniWrite("tester.ini", "Test Module", "Reports", GUICtrlRead($Treport))
    
    
    IniWrite("tester.ini", "Test Module", "Rpt Order", GUICtrlRead($Tordreport))
    
    
    IniWrite("tester.ini", "Test Module", "Billing", GUICtrlRead($Tbilling))
    
    
    IniWrite("tester.ini", "Test Module", "Bill Order", GUICtrlRead($Tordbill))
    
    
    IniWrite("tester.ini", "Test Module", "EDI", GUICtrlRead($Tedi))
    
    
    IniWrite("tester.ini", "Test Module", "EDI Order", GUICtrlRead($Tordedi))
    
    
    
    
    
    
EndFunc 

Func CHKFile()
    If FileExists("tester.ini") Then
        $bfil = 1
    Else
        $bfil = 0
    EndIf
    
EndFunc

If you test the $Tinitials that will show you the problem right away. So just fill out the initials

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$Tinitials = GUICtrlCreateInput("", 125, 90, 30,18)    ;Initials Input Box  ;<---

If $bfil = 1 Then
$var = iniread("tester.ini", "Tester Details", "Tester Initials", "No")

;MsgBox(0,"1", $var)

$TInitials = $var ;<---
GUICtrlSetData(-1,$TInitials)

Ok, so you overwrite $Tinitials which initially holds Input controlID, with data from ini file. And then later try to use it as if it still holds the controlID (GUICtrlRead($Tinitials))? Same mistake for all other controlID variables.

And in future plz restrain yourself from quoting your own long post just to add 1 remark.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

$Tinitials = GUICtrlCreateInput("", 125, 90, 30,18)    ;Initials Input Box  ;<---

If $bfil = 1 Then
$var = iniread("tester.ini", "Tester Details", "Tester Initials", "No")

;MsgBox(0,"1", $var)

$TInitials = $var ;<---
GUICtrlSetData(-1,$TInitials)

Ok, so you overwrite $Tinitials which initially holds Input controlID, with data from ini file. And then later try to use it as if it still holds the controlID (GUICtrlRead($Tinitials))? Same mistake for all other controlID variables.

And in future plz restrain yourself from quoting your own long post just to add 1 remark.

Roger that and Thanks! I am a newbie and so much appreciate the effort.

Share this post


Link to post
Share on other sites

Roger that and Thanks! I am a newbie and so much appreciate the effort.

Just a follow up question to this... Didnt I do that for $Tinitials but nowhere else? It is the function that appears to be breaking and I guess I am not totally understanding what you are saying... I included the snippet of the procedure with only the lines pertinent to the VAR... The msgboxes are for my troubleshooting which I still get Zero... i know this is probably something stupid but I have no resolution

Func CreateINI1 ()
    
    
                

;Tester's Details
    
    $var = GUICtrlRead($Tinitials)

    MsgBox(0,"tinitials", $Tinitials)
    MsgBox(0,"TINIT-VAR",$var)
    
    IniWrite("tester.ini", "Tester Details", "Tester Initials", $var)
;MsgBox(0,"tinitials", $Tinitials)
    
    
    

    
    
    
EndFunc

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