Jump to content
anoig

Need help debugging _arrayadd function

Recommended Posts

anoig

Hi all, 

First, I want to give a huge shout-out to the community. I'm completely self-taught, and have never had to actually ask a question before because the forum is that good at answering questions and explaining things. However, I'm kind of stumped here, and I've been stuck on this problem for almost a full day.

I'm working on a script to populate drafts of deeds at work. I have the main GUI and  a function (ctrl($n) and read()) for adding fields to find and data to replace it with to an array for later use with _word_docfindreplace. All of that works. However, due to the way I have the forms set up, I need to create additional fields and info based on the data that's there. Specifically, if there's only one buyer, I need to add the field [Buyer1&2] and the data in $aArray_Base for [Buyer 1]. I also need to add a field [Buyer 2] and have a blank data set in the next column over in the array, and I need to do the same for the Seller. To this end, the function parties() sets boolean variables $2buyers and $2sellers accordingly. Then, I have buyers() and sellers() to populate the data. 

The problem that I'm running into is that each function works... when ONLY the buyer 1 name field is filled, and when ONLY the seller 1 field is filled.

So if I fill Buyer 1 Name and save it, the data is populated correctly. But when I fill Buyer 1 and Seller 1 name, only the buyer 1 data populates correctly. Worse, when I fill several fields, neither populate correctly. I have no idea why this happens. I've added messageboxes to debug throughout the entire process and can't pinpoint what's causing the issue. The entire script is below. The function(s) in question are buyers() and sellers(). Only Sellers() has messageboxes throughout.

Can someone help walk me through what might be causing this and help me find a solution? Thanks a ton in advance, and sorry for the wall of text.

-Anoig

Spoiler
#include <ButtonConstants.au3> ;AutoIT plugins
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <Word.au3>
#include <ComboConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Randy\Downloads\koda_1.7.3.0\Forms\KNDS.kxf
$KNDS = GUICreate("KNDS DocPrep Wizard", 727, 507, 540, 193)
$MainPage = GUICtrlCreateTab(8, 40, 708, 424)
$TabSheet1 = GUICtrlCreateTabItem("Property")
$Property = GUICtrlCreateGroup("Legal Description", 32, 80, 657, 153)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$InputLegal = GUICtrlCreateEdit("", 40, 96, 641, 129, $ES_WANTRETURN, 0)
GUICtrlSetTip(-1, "Full legal description from Schedule A of Title Commitment")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Buyer = GUICtrlCreateTabItem("Buyer")
$Buyer1Group = GUICtrlCreateGroup("Buyer 1", 24, 72, 329, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$inputbuyer1 = GUICtrlCreateInput("", 120, 104, 217, 22)
GUICtrlSetTip(-1, "Bob Buyer, LLC")
$Buyersingle = GUICtrlCreateRadio("Single", 32, 136, 57, 17)
$BuyerMarried = GUICtrlCreateRadio("Married", 32, 160, 65, 17)
$BuyerLLC = GUICtrlCreateRadio("LLC", 32, 184, 57, 17)
$BuyerInc = GUICtrlCreateRadio("Inc.", 32, 208, 49, 17)
$inputbuyerentitystate = GUICtrlCreateInput("", 272, 208, 73, 22)
GUICtrlSetTip(-1, "Write out state name, e.g. Texas")
$Buyer1label = GUICtrlCreateLabel("Buyer 1 Name:", 32, 104, 75, 18)
$labelbuyerentitystate = GUICtrlCreateLabel("State (only if LLC or Inc.):", 136, 208, 127, 18)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Buyer2Group = GUICtrlCreateGroup("Buyer 2", 368, 72, 321, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Buyer2label = GUICtrlCreateLabel("Buyer 2 Name:", 376, 104, 75, 18)
$InputBuyer2 = GUICtrlCreateInput("", 464, 104, 209, 22)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$GroupBuyAdd = GUICtrlCreateGroup("Buyer's Address", 24, 264, 673, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$labelbuyadd1 = GUICtrlCreateLabel("Address:", 32, 304, 49, 18)
$labelbuyadd2 = GUICtrlCreateLabel("City, State, Zip:", 32, 336, 81, 18)
$labelbuycounty = GUICtrlCreateLabel("County:", 32, 368, 41, 18)
$InputBuyerAdd1 = GUICtrlCreateInput("", 120, 304, 561, 22)
GUICtrlSetTip(-1, "123 Main Street")
$InputBuyerAdd2 = GUICtrlCreateInput("", 120, 336, 561, 22)
GUICtrlSetTip(-1, "City, State Zip")
$InputBuyerAdd3 = GUICtrlCreateInput("", 120, 368, 561, 22)
GUICtrlSetTip(-1, "County")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Seller = GUICtrlCreateTabItem("Seller")
$Group1 = GUICtrlCreateGroup("Seller 1", 26, 73, 329, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$InputSeller1 = GUICtrlCreateInput("", 122, 105, 217, 22)
GUICtrlSetTip(-1, "Sally the Seller, LLC")
$Labelseller1 = GUICtrlCreateLabel("Seller 1 Name:", 34, 105, 73, 18)
$SellerMarried = GUICtrlCreateRadio("Married", 34, 161, 65, 17)
$SellerSingle = GUICtrlCreateRadio("Single", 34, 137, 57, 17)
$SellerLLC = GUICtrlCreateRadio("LLC", 34, 185, 57, 17)
$SellerInc = GUICtrlCreateRadio("Inc.", 34, 209, 49, 17)
$Label2 = GUICtrlCreateLabel("State (only if LLC or Inc.):", 138, 209, 127, 18)
$InputSellerEntityState = GUICtrlCreateInput("", 274, 209, 73, 22)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Seller 2", 372, 73, 321, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Seller 2 Name:", 380, 105, 73, 18)
$InputSeller2 = GUICtrlCreateInput("", 468, 105, 209, 22)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Seller's Address", 26, 265, 673, 185)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label4 = GUICtrlCreateLabel("Address:", 34, 305, 49, 18)
$Label5 = GUICtrlCreateLabel("City, State Zip:", 34, 337, 81, 18)
$Label6 = GUICtrlCreateLabel("County:", 34, 369, 41, 18)
$InputSellerAdd1 = GUICtrlCreateInput("", 122, 305, 561, 22)
GUICtrlSetTip(-1, "123 Main Street")
$InputSellerAdd2 = GUICtrlCreateInput("", 122, 337, 561, 22)
GUICtrlSetTip(-1, "City, State Zip")
$InputSellerAdd3 = GUICtrlCreateInput("", 122, 369, 561, 22)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Lender = GUICtrlCreateTabItem("Lender")
GUICtrlSetState(-1,$GUI_SHOW)
$Group5 = GUICtrlCreateGroup("Lender Info", 19, 73, 393, 161)
$Label7 = GUICtrlCreateLabel("Address:", 27, 129, 45, 17)
$Label8 = GUICtrlCreateLabel("City, State, Zip:", 27, 161, 81, 18)
$Label9 = GUICtrlCreateLabel("County:", 27, 193, 40, 17)
$InputLenderAdd1 = GUICtrlCreateInput("", 115, 129, 281, 21)
GUICtrlSetTip(-1, "123 Main Street")
$InputLenderAdd2 = GUICtrlCreateInput("", 115, 161, 281, 21)
GUICtrlSetTip(-1, "City, State, Zip")
$InputLenderAdd3 = GUICtrlCreateInput("", 115, 193, 281, 21)
GUICtrlSetTip(-1, "e.g. Tarrant County")
$Label1 = GUICtrlCreateLabel("Lender Name:", 27, 97, 71, 17)
$InputLender = GUICtrlCreateInput("", 115, 97, 281, 21)
GUICtrlSetTip(-1, "We Lend Things, Inc.")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Loan Info:", 16, 248, 681, 201)
$Label10 = GUICtrlCreateLabel("Principal:", 27, 272, 47, 17)
$Label11 = GUICtrlCreateLabel("Write Out:", 27, 305, 52, 17)
$Label14 = GUICtrlCreateLabel("", 27, 337, 4, 4)
$InputPrincipal = GUICtrlCreateInput("", 88, 272, 153, 21)
GUICtrlSetTip(-1, "$xx,xxx.xx")
$InputWriteOut = GUICtrlCreateEdit("", 88, 304, 593, 129, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetTip(-1, "THIS MANY AND NO/100 DOLLARS (NO LINE BREAKS)")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("Trustee Info", 418, 73, 281, 161)
$Label18 = GUICtrlCreateLabel("Trustee Name:", 426, 97, 74, 17)
$InputTrustee = GUICtrlCreateInput("", 506, 97, 185, 21)
GUICtrlSetTip(-1, "I.M. Trustworthy, Jr.")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
$GFLabel = GUICtrlCreateLabel("GF No:", 8, 8, 38, 17)
$CommonLabel = GUICtrlCreateLabel("Property Address:", 128, 8, 87, 17)
$CloseDateLabel = GUICtrlCreateLabel("Closing Date:", 544, 8, 67, 17)
$InputGF = GUICtrlCreateInput("", 48, 8, 73, 21)
GUICtrlSetTip(-1, "123456-RN-X")
$InputCommon = GUICtrlCreateInput("", 216, 8, 321, 21)
GUICtrlSetTip(-1, "Common address from front of file")
$InputInvoiceNo = GUICtrlCreateInput("", 72, 472, 129, 21)
$HelpButton = GUICtrlCreateButton("Help", 632, 32, 81, 25)
$LabelInvoiceNo = GUICtrlCreateLabel("Invoice No.", 8, 472, 59, 17)
$InputClosingDate = GUICtrlCreateInput("", 616, 8, 97, 21)
GUICtrlSetTip(-1, "Close date from contract")
$SaveButton = GUICtrlCreateButton("Save", 640, 472, 73, 25)
GUICtrlSetTip(-1, "Click this when you're ready to prep docs")
$InputType = GUICtrlCreateCombo("", 304, 472, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "GWD|WDVL|WDMR|WDVLMR|SWD|SWDVL|SWDMR|SWDVLMR|Note & DoT|Wraparound Package")
$Label12 = GUICtrlCreateLabel("Doc Type:", 248, 472, 54, 17)
$Label13 = GUICtrlCreateLabel("Doc Cost:", 440, 472, 51, 17)
$InputCost = GUICtrlCreateInput("", 496, 472, 73, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $GF, $type, $fail[0][2], $addfail[1][2], $n = "", $invoice = 4, $sleep = 50, $aArray_invoice[12][2] = [["Field","Data"]], $buyerentitystate, $sellerentitystate, $buyerstatus, $sellerstatus, $buyer2, $seller2, $Cid, $arrayadd[1][2], $Fields[] = ["[Legal]","[Common]","[GF]","[CloseDate]","[Buyer 1]","[Buyer 2]","[Buyeradd1]","[Buyeradd2]","[Buyeradd3]","[Seller 1]","[Seller 2]","[Selleradd1]","[Selleradd2]","[Selleradd3]","[Lender]","[Lenderadd1]","[Lenderadd2]","[Lenderadd3]","[Principal]","[Write Out]","[Trustee]","[Invoice No.]","[Type]"]
hotkeyset("`", "prep")

While 1 ; What to do when buttons are pressed/forms are filled
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $HelpButton
            msgbox(-1, "Help", "Under construction!")
         Case $SaveButton
            Read()
            Parties()
            Buyers()
            Sellers()
            _arraydisplay($aArray_Base, "Saved Data")
    EndSwitch
 WEnd

 Func Read() ; Function for getting all data from input boxes
    global $aArray_Base[0][2] ; Start with clean array each time function is run
    For $n = 1 to 23 ; Make sure upper boundary is highest number in ctrl()!!
       If Guictrlread(Ctrl($n)) = NOT ("" OR 0)  Then ; Skip blank data
            $arrayadd[0][0] = $Fields[$n-1]         ; Define temporary array with data from $fields and Ctrl($n)
            $arrayadd[0][1] = Guictrlread(Ctrl($n)) ;
         If _arraysearch($aArray_Base, $arrayadd[0][0]) = NOT (-1) Then ; If [Field] is already in main array, replace data from input box, leave [Field] same
            $aArray_Base[_arraysearch($aArray_Base, $arrayadd[0][0])][1] = GuiCtrlRead(Ctrl($n))
         ElseIf @error = (6 OR 3) Then ; If Data not found or main array is empty, append new index to main array
         _arrayadd($aArray_Base, $arrayadd)
         EndIf
      EndIf
   Next
 EndFunc

 Func Ctrl($n) ; Function for passing control handles to for loops
    Select
    Case $n = 1
       $cid = $inputlegal
    Case $n = 2
       $cid = $inputcommon
    Case $n = 3
       $cid = $inputGF
    Case $n = 4
       $cid = $inputClosingDate
    Case $n = 5
       $cid = $inputBuyer1
    Case $n = 6
       $cid = $inputBuyer2
    Case $n = 7
       $cid = $inputBuyeradd1
    Case $n = 8
       $cid = $inputBuyeradd2
    Case $n = 9
       $cid = $inputBuyeradd3
    Case $n = 10
       $cid = $inputSeller1
    Case $n = 11
       $cid = $inputSeller2
    Case $n = 12
       $cid = $inputSelleradd1
    Case $n = 13
       $cid = $inputSelleradd2
    Case $n = 14
       $cid = $inputSelleradd3
    Case $n = 15
       $cid = $inputLender
    Case $n = 16
       $cid = $inputLenderadd1
    Case $n = 17
       $cid = $inputLenderadd2
    Case $n = 18
       $cid = $inputLenderadd3
    Case $n = 19
       $cid = $inputPrincipal
    Case $n = 20
       $cid = $inputWriteOut
    Case $n = 21
       $cid = $inputTrustee
    Case $n = 22
       $cid = $inputInvoiceNo
    Case $n = 23
       $cid = $inputType
    EndSelect
    Return $Cid
 EndFunc

Func Parties() ; Determine how many buyers and sellers
   local $row = _arraysearch($aArray_Base, "[Seller 2]")
  If  $row = -1 Then ; If no seller 2, seller 2 false
     global $2sellers = False
  ElseIf $aArray_Base[$row][1] = "" Then ; If seller 2 label, but not data, seller 2 false
     global $2sellers = False
  Else ; If seller 2 label and data, seller 2 true
     Global $2sellers = True
  EndIf
   local $row = _arraysearch($aArray_Base, "[Buyer 2]")
  If  $row = -1 Then
     global $2buyers = False
  ElseIf $aArray_Base[$row][1] = "" Then
     global $2buyers = False
  Else
     global $2buyers = True
  EndIf
  msgbox(-1, "", "2sellers " & $2sellers & "2buyers " & $2buyers)
EndFunc

Func Buyers()
If $2buyers = False Then ; [Buyer1&2] = [Buyer 1]
   local  $row = _arraysearch($aArray_Base, "[Buyer 1]")
   If $row = NOT -1 Then ; account for blank [Buyer 1]
   $arrayadd[0][0] = "[Buyer1&2]"
   $arrayadd[0][1] = $aArray_Base[$row][1]
   _arrayadd($aArray_Base, $arrayadd)

   $arrayadd[0][0] = "[Buyer 2]" ; Delete Buyer 2 if found
   $arrayadd[0][1] = ""
   _arrayadd($aArray_Base, $arrayadd)
   EndIf
ElseIf $2buyers = True Then ; [Buyer1&2] = [Buyer 1] and [Buyer 2]
   Local $1row = _arraysearch($aArray_Base, "[Buyer 1]")
   Local $2row = _arraysearch($aArray_Base, "[Buyer 2]")
    $arrayadd[0][0] = "[Buyer1&2]"
    $arrayadd[0][1] = "" & $aArray_Base[$1row][1] & " and " & $aArray_Base[$2row][1]
   _arrayadd($aArray_Base, $arrayadd)
EndIf
EndFunc

Func Sellers()
If $2sellers = False Then
   local $row = _arraysearch($aArray_Base, "[Seller 1]")
   msgbox(-1, "Sellers()","$row = " & $row)
   If $row = NOT -1 Then
      msgbox(-1, "Sellers()", "$row is not -1")
   $arrayadd[0][0] = "[Seller1&2]"
   msgbox(-1, "Sellers()", "$arrayadd[0][0] = " & $arrayadd[0][0])
   $arrayadd[0][1] = $aArray_Base[$row][1]
   msgbox(-1, "", "$arrayadd[0][1] = " & $arrayadd[0][1])
   _arrayadd($aArray_Base, $arrayadd)

   $arrayadd[0][0] = "[Seller 2]"
   $arrayadd[0][1] = ""
   _arrayadd($aArray_Base, $arrayadd)
   EndIf
ElseIf $2sellers = True Then
   Local $1row = _arraysearch($aArray_Base, "[Seller 1]")
   Local $2row = _arraysearch($aArray_Base, "[Seller 2]")
    $arrayadd[0][0] = "[Seller1&2]"
    $arrayadd[0][1] = "" & $aArray_Base[$1row][1] & " and " & $aArray_Base[$2row][1]
   _arrayadd($aArray_Base, $arrayadd)
   EndIf
EndFunc

Func Signatures() ; Create labels and data to fill buyer/seller fields with data entered already
EndFunc

Func Acknowledge() ; Format and fill acknowledgements based on number and type of buyers and sellers
EndFunc

Func prep()
  local $oWord = _Word_Create() ; Create Application Object
   If @error Then
      Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", "Error creating application object. Script terminated.")
   EndIf
  local $filepath = "C:\Users\Randy\Dropbox\Doc Prep\_KNDS Doc Prep Wizard (windows only)\GWD - Seller(s) People - Experiment.docx" ; Select Template to open
  local $oDoc = _word_docopen($oWord, $filepath) ; Open template
   If @error Then
      Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", "Error opening template. Script terminated.")
   EndIf
   For $i = 1 to Ubound($aArray_Base) ; Find and replace all [Fields] from main array with data
      _Word_DocFindReplace($oDoc, "" & $aArray_base[$i-1][0], "" & $aArray_Base[$i-1][1])
         If @error Then
            $addfail[0][0] = $aArray_Base[$i-1][0]
            $addfail[0][1] = $aArray_Base[$i-1][1]
            _arrayadd($fail, $addfail)
   EndIf
Next
   _ArrayDisplay($fail, "Items not replaced")
MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", "Completed Find and replace. Iterations: "&$i)
   _word_docsaveas($oDoc, @HomeDrive & @HomePath & "\Dropbox\Doc Prep\_KNDS Doc Prep Wizard (windows only)\___Completed\" & guictrlread($inputgf) & " - " & guictrlread($inputtype)) ; Save working document with GF number
      If @error Then
      Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", "Error saving deed document. Script terminated." & @CRLF &  "Make sure Dropbox is installed on the PC." & @CRLF & @CRLF & "Also make sure that the following filepath exists:" & @CRLF & @CRLF & @HomeDrive & @HomePath & "\Dropbox\Doc Prep\_KNDS Doc Prep Wizard (windows only)\___Completed\")
   EndIf
   Shellexecute("" & @homedrive & @homepath & "\Dropbox\Doc Prep\_KNDS Doc Prep Wizard (windows only)\___Completed\")
   MsgBox($MB_SYSTEMMODAL, "KNDS Doc Prep Wizard", "Documents successfully prepared." & @CRLF & "Please inspect the document and the invoice for any errors, then drag and drop them to the appropriate location to save dropbox space.")
EndFunc

 

 

Share this post


Link to post
Share on other sites
anoig

Hi all,

I figured it out. Sorry for the inconvenience. I was doing this:

Func Buyers()
If $2buyers = False Then ; [Buyer1&2] = [Buyer 1]
   local  $row = _arraysearch($aArray_Base, "[Buyer 1]")
   If $row = NOT -1 Then ; account for blank [Buyer 1] ; <================= ERROR IS HERE
   $arrayadd[0][0] = "[Buyer1&2]"
   $arrayadd[0][1] = $aArray_Base[$row][1]
   _arrayadd($aArray_Base, $arrayadd)

   $arrayadd[0][0] = "[Buyer 2]" ; Delete Buyer 2 if found
   $arrayadd[0][1] = ""
   _arrayadd($aArray_Base, $arrayadd)
   EndIf
ElseIf $2buyers = True Then ; [Buyer1&2] = [Buyer 1] and [Buyer 2]
   Local $1row = _arraysearch($aArray_Base, "[Buyer 1]")
   Local $2row = _arraysearch($aArray_Base, "[Buyer 2]")
    $arrayadd[0][0] = "[Buyer1&2]"
    $arrayadd[0][1] = "" & $aArray_Base[$1row][1] & " and " & $aArray_Base[$2row][1]
   _arrayadd($aArray_Base, $arrayadd)
EndIf
EndFunc

Using $row = NOT -1 was causing problems, although I'm not sure why. Using $row <> -1 fixed everything. Thanks anyway!

-Anoig

Edited by anoig

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

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      First, I want to apologize with you for the title not very clear, but I thought a little bit on which title to set at the thread, and this is the one that came in mind.
      Now, let me explain what I'm trying to understand.

      I am making an application ( with n clients ), with an SQLite Database, which has a Main form, and n sub-forms... 
      Since these sub-forms are called several times, because they are used to add or update records to the Database, I put the code that generates the GUI of these sub-forms in Functions.
      There are two sub-forms which are "treated" as two main forms, since even them have n sub-forms, which perform various tasks.
      Where am I stucked?

      For the Main form I created a Status Bar, in order to display messages ( add/delete/update/search results ), and it works perfectly with all the forms which don't have other sub-forms.
      For the two forms, which indeed have n sub-forms, I created two separated Status Bars, which are (re)created everytime I call the function that then displays the form.
      Practically, I can't set icons to these two Status Bars, and I don't know why.
      I'm really sorry that I don't feel clear enough, so, here you are an example of what I am saying.
      I recreated exactly what my script does:
      #include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $frmSubForm, _ $txtSubFormField, _ $sbSubFormStatusBar, _ $objSB_IconError = _WinAPI_LoadShell32Icon(109), _ $objSB_IconInformation = _WinAPI_LoadShell32Icon(277) #Region ### START Koda GUI section ### Form= $frmMainForm = GUICreate("Main Form", 300, 300, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitApplication") $sbMainStatusBar = _GUICtrlStatusBar_Create($frmMainForm) $btnCreateSubForm = GUICtrlCreateButton("Create Sub Form", 105, 110, 75, 41, BitOR($BS_CENTER,$BS_VCENTER,$BS_MULTILINE)) GUICtrlSetOnEvent(-1, "GenerateSubForm") GUICtrlSetFont(-1, 10, 400, 0, "Arial") _GUICtrlStatusBar_SetSimple($sbMainStatusBar) _GUICtrlStatusBar_SetText($sbMainStatusBar, "") GUISetState(@SW_SHOW, $frmMainForm) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func ExitApplication() Exit EndFunc Func GenerateSubForm() #Region ### START Koda GUI section ### Form= $frmSubForm = GUICreate("Sub-Form", 300, 300, -1, -1, -1, -1, $frmMainForm) GUISetOnEvent($GUI_EVENT_CLOSE, "DeleteSubForm") $txtSubFormField = GUICtrlCreateInput("", 0, 0, 100, 20) $btnCheckSubFormField = GUICtrlCreateButton("Check Field", 105, 110, 75, 41, BitOR($BS_CENTER,$BS_VCENTER,$BS_MULTILINE)) GUICtrlSetOnEvent(-1, "CheckSubFormField") GUICtrlSetFont(-1, 10, 400, 0, "Arial") $sbSubFormStatusBar = _GUICtrlStatusBar_Create($frmSubForm) _GUICtrlStatusBar_SetSimple($sbSubFormStatusBar) _GUICtrlStatusBar_SetText($sbSubFormStatusBar, "") GUISetState(@SW_SHOW, $frmSubForm) GUISetState(@SW_DISABLE, $frmMainForm) #EndRegion ### END Koda GUI section ### EndFunc Func DeleteSubForm() ; Declared Globally => $frmSubForm GUIDelete($frmSubForm) GUISetState(@SW_ENABLE, $frmMainForm) EndFunc Func WriteToStatusBar($sbStatusBar, $objSB_Icon, $strText) _GUICtrlStatusBar_SetIcon($sbStatusBar, 0, $objSB_Icon) _GUICtrlStatusBar_SetText($sbStatusBar, $strText) ConsoleWrite("Icon Handle: " & $objSB_Icon & @CRLF) EndFunc Func CheckSubFormField() ; Declared Globally => $txtSubFormField If GUICtrlRead($txtSubFormField) = "" Then ; Declared Globally => $sbStatusBar WriteToStatusBar($sbSubFormStatusBar, $objSB_IconError, "Field NOK.") Else WriteToStatusBar($sbSubFormStatusBar, $objSB_IconInformation, "Field OK.") EndIf EndFunc The text is set, but icon is not.
      Could someone please tell me why?
      Thanks everyone in advance  

      Best Regards.
    • VollachR
      By VollachR
      Hi,
      I'm looking for a way to take a number value from a Row2 of a 2D array and according to this check if files that appear in rows 3-11 in the array exists.
      For example, if the number in Row2 is 5 I need to check for the files in Row 3-6 only, if it is 6 than rows 3-7 and so on.
      I thought on using a FOR loop but I have very little experience with those.
      Can you suggest the best way to do what I need?
      BTW, the files in Rows 3-11 will usually have blank value for any row above the number in Row2 (e.g. Row2 = 5 so Rows3-6 will have values but 8-11 be empty), The values I need are in Column 1 of the array, the name of the key from the INI file that the array was created from is in Column 0.
      Full Example:
      Row2 of Array:
      Col0 = Games# - Col1 = 5
      Rows3-6
      Col0 = Exe2 - Col1 = Path To File
      Col0 = Exe3 - Col1 = Path To File
      Col0 = Exe4 - Col1 = Path To File
      Col0 = Exe5 - Col1 = Path To File
      I need that if Row2 is 5 to check these above for rows if the file exists, if it was 6 then the next row as well and so on up until number 10 in Row2 as it can't go above 10.
      So basically for whatever number in Row2 from 2-10 need to check 1-9 rows from 3-11 to see if the files in Col1 exists and if any of them don't exist it should call a function that shows an error message.
      I'm pretty sure I have the first line of the for look correct:
      For $i = 1 To $aAIO[2][1] Just not sure how to continue from there, also not sure if $i should be equal 1 or 2.
      Help will be appreciated.
    • FMS
      By FMS
      Hello,
      I'm trying to get data from twitter to an array and so far I found an Twitter UDF whish lookes very intresting but couldn't get it to work.
      It lookes not supported any more(2010) and buggy when i read all te replies.
      More around this subject (autoit and twitter) i couldn't find on this forum.
      Is there sombody who know's a good way to get live data from twitter to an array inside autoit?
      (I kinda doubt that this isn't tackled before)
      In the end I was hoping to get all tweets from date to date from an specific subject inside a 2D array to work whit.
    • AndreasNWWWWW
      By AndreasNWWWWW
      I got a question:  i am trying to run different functions based upon what i select in these radio buttons.(code below)
      it needs to check server 1. then run function 1 or function 2 after what i selected in the checkbox.
      once that function is done it moves to the next one, until it has been trough all 5 
       
      iv'e tried using while loops with different while $i equals to something but then i manualy need to go in and edit the script every time.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Server2 = GUICtrlCreateLabel("Server2", 216, 95, 41, 17) $server1 = GUICtrlCreateLabel("Server1", 216, 72, 41, 17) $server4 = GUICtrlCreateLabel("Server4", 216, 144, 41, 17) $server3 = GUICtrlCreateLabel("Server3", 216, 119, 41, 17) $server5 = GUICtrlCreateLabel("Server5", 216, 170, 41, 17) $Start = GUICtrlCreateButton("Start", 240, 248, 147, 25) $Checkbox1 = GUICtrlCreateCheckbox("function1", 288, 72, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("function2", 392, 72, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("function1", 288, 96, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("function2", 392, 96, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("function1", 288, 120, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("function2", 392, 120, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("function1", 288, 144, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("function2", 392, 144, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("function1", 288, 170, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("function2", 392, 170, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
    • Reziskonh
      By Reziskonh
      Hi, everybody
      I look for GUI whose behavior similar to the message of an email client or antivirus
      In other words:
          Any PC screen able to calculate the size
          To consider the Task bar size
          To find the lower corner on the right/below and to nestle on it

      Notes:
      In GUI the GUICtrlCreateEdit field (as option) - that can be received and displayed through variable information
      Thanks a lot
      PS
      I use the translator, excuse if something is not clear
       

×