Sign in to follow this  
Followers 0
BinaryBrother

Just needs Revision

12 posts in this topic

I'm almost embarrassed to show my source, it's the sloppiest thing I've ever coded, and it's a fine example of my AutoIt Laziness, and ignorance. Please don't criticize my code in an ugly, obscene, or un-useful way... That's all I ask... If you have something negative to say, suggest something positive in it's place.

I know this code is sloppy... So you don't have to tell me that again... lol. As you can see, everything I've wrote so far, is just an attempt to keep from getting flamed over code so sloppy... It's a complete mess... I've also attached the code as an attachment if some like downloading for use with Scite.

Besides more clean code, here are a few things I'm having trouble with... :)

Including the 'Item#' in 'View Inventory' without 500 lines of code.

Viewing unusable inventory from an INI.

Including Unusable Inventory into main 'View Inventory' screen, while also showing 'WHY' it's unusable.. M,A,T,MA,MT,AT,MAT, etc... beside the quantity...

Item# | Product | Usable | Unusable | Damage Code

The more I add, the more impossible the code becomes to work with... lol

I'll also take friendly suggestions on the ethics of better coding... :P

Thanks to Klaatu for key-down script, which has now been simplified. Also, thanks to an unknown member for most of the 'View Inventory' portion of the code, he knows who he is... :P

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#Include <Misc.au3>
#Include <File.au3>
;#NoTrayIcon   ; For use after BETA
#RequireAdmin   ;Vista fix, breaks some XP OS's with only one user account with no password.

If Not FileExists(@ScriptDir & "\options\options.ini") Then
    DirCreate(@ScriptDir & "\Options\")
    IniWrite(@ScriptDir & "\options\options.ini","options","notify","YES")
EndIf

If Not FileExists(@ScriptDir & "\Inventory") Then
    DirCreate(@ScriptDir & "\Inventory\")
    DirCreate(@ScriptDir & "\Inventory\Unusable\")
EndIf

If FileExists(@ScriptDir & "\options\options.ini") Then
    $Nothing = "null"
Else
    IniWrite(@ScriptDir & "\options\options.ini","options","notify","YES")
EndIf

$InventoryMain = GUICreate("Inventory Main", 727, 435, -1, -1)
GUISetBkColor(0xFFFFFF)
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\Other\LCC.jpg", 56, 72, 596, 255, BitOR($SS_NOTIFY,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
$MenuItem1 = GUICtrlCreateMenu("&Main")
$MenuItem2 = GUICtrlCreateMenuItem("View Inventory", $MenuItem1)
$MenuItem13 = GUICtrlCreateMenuItem("Options",$MenuItem1)
$MenuItem3 = GUICtrlCreateMenuItem("Correct Total", $MenuItem1)
$MenuItem4 = GUICtrlCreateMenuItem("Exit", $MenuItem1)
$MenuItem8 = GUICtrlCreateMenu("&Shipping")
$MenuItem5 = GUICtrlCreateMenuItem("Outgoing Product", $MenuItem8)
$MenuItem7 = GUICtrlCreateMenu("&Receiving")
$MenuItem10 = GUICtrlCreateMenuItem("Incoming Product", $MenuItem7)
$MenuItem11 = GUICtrlCreateMenuItem("EST. Unusable Bin", $MenuItem7)
$MenuItem6 = GUICtrlCreateMenu("&About")
$MenuItem12 = GUICtrlCreateMenuItem("Help", $MenuItem6)
GUISetState(@SW_SHOW)
InventoryMain()
Func InventoryMain()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $MenuItem1 ; File Button
        Case $MenuItem13 ; Options
        Case $MenuItem2 ; View Inventory
            ViewInventory()
        Case $MenuItem3 ; Correct Total
            CorrectTotal()
        Case $MenuItem4 ; EXIT
            $close = Msgbox(4,"WARNING","You have selected to Exit this application, do you wish to Exit now?")
            If $close = "6" Then
                Exit
            Else
                MsgBox(4096,"CONFIRMED","Session termination has been halted")
            EndIf
            
        Case $MenuItem8 ; Shipping Button
        Case $MenuItem5 ; Outgoing Product
            OutGoingMod()
        Case $MenuItem7 ; Receiving Button
        Case $MenuItem10 ; Incoming Product
            IncomingMod()
        Case $MenuItem11 ; Unusable Bin
            UnusableBin()
        Case $MenuItem6 ; About Button
        Case $MenuItem12 ; Help
            Msgbox(4096,"Told ya...","How's this for never finishing anything?")
            SoundPlay(@ScriptDir & "\evil.wav")
            Msgbox(4096,"Told ya...","P.S. I write programs not help files... Contact: 1-(270)-589-2399")
        Case $Pic1
    EndSwitch
WEnd
EndFunc

Func ViewInventory()
;;;;;

;IniReadSection

;;;;;
$productList = _FileListToArray(@ScriptDir & "\Inventory","*",1)  ; Fixed to retrieve files only, not directories
Local $listview, $button, $item1, $item2, $item3, $input1, $msg
$ViewInventory = GUICreate("Inventory View", 300, 447, 193, 125, -1, $WS_EX_ACCEPTFILES)
$listview = GUICtrlCreateListView("Product                               |Quantity ", 0, 0, 300, 440);,$LVS_SORTDESCENDING)
For $n = 1 To $productList[0]
    $fr = FileRead(@ScriptDir & "\Inventory\" & $productList[$n], 10)
    $num = Number($fr)
    $item1 = GUICtrlCreateListViewItem($productList[$n] & "|" & $num, $listview)
Next
GUISetState(@SW_SHOW, $ViewInventory)
Do
    $VImsg = GUIGetMsg()

Until $VImsg = $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE,$ViewInventory)
InventoryMain()
EndFunc

Func CorrectTotal()
    
EndFunc

Func OutGoingMod()
Local $KEYS, $I
$Items = StringSplit("CAFA30P,CARY30P,CRCR15D,CRCR15P,CRCR20P,CRCR30P,CRRG20P,EACC30P,EACR30P,ERCR20P,HAPR20P,HARG20P,HARG30P,HARP20P,HFBM15P,HFBM20P,NSCN20P,NSGN20P,OGRG10P,OPRG40P,OTRG40P,PCEN20P,PLFP30P,PLRG20P,PMRG20P,PNFP30P,PNRG20P,PRFP30P,PRRG20P,PSBS10P,RBPR20P,RBRG15D,RBRG15P,RBRG20P,RGGR20P,RRPR20P,RRRG15D,RRRG15P,RRRG20P", ",")
$KEYS = StringSplit("30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A,5B,5C,60,61,62,63,64,65,66,67,68,69", ",")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$OutgoingForm = GUICreate("Outgoing", 722, 159, 208, 232)
$OutGoingProduct = GUICtrlCreateCombo("Product", 168, 64, 249, 25)
$Group1 = GUICtrlCreateGroup("", 8, 40, 705, 73)
$OutGoingQuantity = GUICtrlCreateInput("0", 472, 64, 49, 21)
GUICtrlSetLimit($OutGoingQuantity, 2)
$OutGoingItem = GUICtrlCreateInput("Item #", 48, 64, 89, 21,$ES_UPPERCASE)
GUICtrlSetLimit($OutGoingItem,7)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ShipLoad = GUICtrlCreateButton("Shipped Load", 544, 56, 137, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Item #", 48, 16, 82, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
$Label2 = GUICtrlCreateLabel("Outgoing", 440, 16, 108, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
GUICtrlSetColor(-1, 0x008000)
$Label4 = GUICtrlCreateLabel("Product", 240, 16, 95, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
GUICtrlSetData($OutGoingProduct, "                                                                                   ")
GUICtrlSetData($OutGoingProduct, "All Bark Cypress from Fargo GA 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Cypress Royale 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Cypress Rose 1.5 CuFt Double Pallet")
GUICtrlSetData($OutGoingProduct, "Cypress Rose 1.5 CuFt Singles")
GUICtrlSetData($OutGoingProduct, "Cypress Rose 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Cypress Rose 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Cypress 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Classic Cedar Mulch 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Cedar Royale 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Cedar Rose 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Preen Mulch Plus Hardwood 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Hardwood 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Hardwood 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Select Hardwood Mulch 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Black Medallion 1.5 CuFt")
GUICtrlSetData($OutGoingProduct, "Black Medallion Hardwood 2 CuFt")
GUICtrlSetData($OutGoingProduct, "N.R. Softscape Chestnut 2 CuFt")
GUICtrlSetData($OutGoingProduct, "N.R. Softscape Golden 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Garden Compost 1.0 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Garden Potting Soil 1.0 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Top Soil 1.0 CuFt")
GUICtrlSetData($OutGoingProduct, "Enriched Soil Conditioner 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Forest Pine Mulch 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Pine Mulch 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Mini Nug 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Forest Pine Nuggets 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Nuggets 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Forest Pine Rustic Mulch 3 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Rustic Mulch 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Pine Straw Baled Palletized")
GUICtrlSetData($OutGoingProduct, "Preen Mulch Plus Midnight Black 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Color Enhanced Black 1.5 Double Pallet")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Color Enhanced Black 1.5 Singles")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Color Enhanced Black 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Golden Rose Colored Mulch 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Preen Mulch Plus Russet Red 2 CuFt")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Color Enhanced 1.5 Double Pallet")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Color Enhanced 1.5 Singles")
GUICtrlSetData($OutGoingProduct, "Royal Gardens Color Enhanced Red 2 CuFt")
GUISetState(@SW_SHOW,$OutGoingForm)
While 1
$ItemSearch = "null"
; Key down script start
  For $I = 1 To $KEYS[0]
    If _IsPressed ($KEYS[$I]) Then
        $ItemSearch = GUICtrlRead($OutGoingItem)
    EndIf
Next
; Key down Scripty ended *Thanks Klaatu!
For $I = 1 To $Items[0]
    If $ItemSearch = ($Items[$I]) Then
$CAFA30P = "All Bark Cypress from Fargo GA 3 CuFt"
$CARY30P = "Cypress Royale 3 CuFt"
$CRCR15D = "Cypress Rose 1.5 CuFt Double Pallet"
$CRCR15P = "Cypress Rose 1.5 CuFt Singles"
$CRCR20P = "Cypress Rose 2 CuFt"
$CRCR30P = "Cypress Rose 3 CuFt"
$CRRG20P = "Royal Gardens Cypress 2 CuFt"
$EACC30P = "Classic Cedar Mulch 3 CuFt"
$EACR30P = "Cedar Royale 3 Cuft"
$ERCR20P = "Cedar Rose 2 CuFt"
$HAPR20P = "Preen Mulch Plus Hardwood 2 CuFt"
$HARG20P = "Royal Gardens Hardwood 2 CuFt"
$HARG30P = "Royal Gardens Hardwood 3 CuFt"
$HARP20P = "Select Hardwood Mulch 2 CuFt"
$HFBM15P = "Black Medallion 1.5 CuFt"
$HFBM20P = "Black Medallion Hardwood 2 CuFt"
$NSCN20P = "N.R. Softscape Chestnut 2 CuFt"
$NSGN20P = "N.R. Softscape Golden 2 CuFt"
$OGRG10P = "Royal Garden Compost 1.0 CuFt"
$OPRG40P = "Royal Garden Potting Soil 1.0 CuFt"
$OTRG40P = "Royal Gardens Top Soil 1.0 CuFt"
$PCEN20P = "Enriched Soil Conditioner 2 CuFt"
$PLFP30P = "Forest Pine Mulch 3 CuFt"
$PLRG20P = "Royal Gardens Pine Mulch 2 CuFt"
$PMRG20P = "Royal Gardens Mini Nug 2 CuFt"
$PNFP30P = "Forest Pine Nuggets 3 CuFt"
$PNRG20P = "Royal Gardens Nuggets 2 CuFt"
$PRFP30P = "Forest Pine Rustic Mulch 3 CuFt"
$PRRG20P = "Royal Gardens Rustic Mulch 2 CuFt"
$PSBS10P = "Pine Straw Baled Palletized"
$RBPR20P = "Preen Mulch Plus Midnight Black 2 CuFt"
$RBRG15D = "Royal Gardens Color Enhanced Black 1.5 Double Pallet"
$RBRG15P = "Royal Gardens Color Enhanced Black 1.5 Singles"
$RBRG20P = "Royal Gardens Color Enhanced Black 2 CuFt"
$RGGR20P = "Golden Rose Colored Mulch 2 CuFt"
$RRPR20P = "Preen Mulch Plus Russet Red 2 CuFt"
$RRRG15D = "Royal Gardens Color Enhanced 1.5 Double Pallet"
$RRRG15P = "Royal Gardens Color Enhanced 1.5 Singles"
$RRRG20P = "Royal Gardens Color Enhanced Red 2 CuFt"

        If $Items[$I] = "CAFA30P" Then
            GUICtrlSetData($OutGoingProduct,$CAFA30P)
        EndIf
        If $Items[$I] = "CARY30P" Then
            GUICtrlSetData($OutGoingProduct,$CARY30P)
        EndIf
        If $Items[$I] = "CRCR15D" Then
            GUICtrlSetData($OutGoingProduct,$CRCR15D)
        EndIf
        If $Items[$I] = "CRCR20P" Then
            GUICtrlSetData($OutGoingProduct,$CRCR20P)
        EndIf
        If $Items[$I] = "CRCR30P" Then
            GUICtrlSetData($OutGoingProduct,$CRCR30P)
        EndIf
        If $Items[$I] = "CRRG20P" Then
            GUICtrlSetData($OutGoingProduct,$CRRG20P)
        EndIf
        If $Items[$I] = "EACC30P" Then
            GUICtrlSetData($OutGoingProduct,$EACC30P)
        EndIf
        If $Items[$I] = "EACR30P" Then
            GUICtrlSetData($OutGoingProduct,$EACR30P)
        EndIf
        If $Items[$I] = "ERCR20P" Then
            GUICtrlSetData($OutGoingProduct,$ERCR20P)
        EndIf
        If $Items[$I] = "HAPR20P" Then
            GUICtrlSetData($OutGoingProduct,$HAPR20P)
        EndIf
        If $Items[$I] = "HARG20P" Then
            GUICtrlSetData($OutGoingProduct,$HARG20P)
        EndIf
        If $Items[$I] = "HARG30P" Then
            GUICtrlSetData($OutGoingProduct,$HARG30P)
        EndIf
        If $Items[$I] = "HARP20P" Then
            GUICtrlSetData($OutGoingProduct,$HARP20P)
        EndIf
        If $Items[$I] = "HFBM15P" Then
            GUICtrlSetData($OutGoingProduct,$HFBM15P)
        EndIf
        If $Items[$I] = "HFBM20P" Then
            GUICtrlSetData($OutGoingProduct,$HFBM20P)
        EndIf
        If $Items[$I] = "NSCN20P" Then
            GUICtrlSetData($OutGoingProduct,$NSCN20P)
        EndIf
        If $Items[$I] = "NSGN20P" Then
            GUICtrlSetData($OutGoingProduct,$NSGN20P)
        EndIf
        If $Items[$I] = "OGRG10P" Then
            GUICtrlSetData($OutGoingProduct,$OGRG10P)
        EndIf
        If $Items[$I] = "OPRG40P" Then
            GUICtrlSetData($OutGoingProduct,$OPRG40P)
        EndIf
        If $Items[$I] = "OTRG40P" Then
            GUICtrlSetData($OutGoingProduct,$OTRG40P)
        EndIf
        If $Items[$I] = "PCEN20P" Then
            GUICtrlSetData($OutGoingProduct,$PCEN20P)
        EndIf
        If $Items[$I] = "PLFP30P" Then
            GUICtrlSetData($OutGoingProduct,$PLFP30P)
        EndIf
        If $Items[$I] = "PLRG20P" Then
            GUICtrlSetData($OutGoingProduct,$PLRG20P)
        EndIf
        If $Items[$I] = "PMRG20P" Then
            GUICtrlSetData($OutGoingProduct,$PMRG20P)
        EndIf
        If $Items[$I] = "PNFP30P" Then
            GUICtrlSetData($OutGoingProduct,$PNFP30P)
        EndIf
        If $Items[$I] = "PNRG20P" Then
            GUICtrlSetData($OutGoingProduct,$PNRG20P)
        EndIf
        If $Items[$I] = "PRFP30P" Then
            GUICtrlSetData($OutGoingProduct,$PRFP30P)
        EndIf
        If $Items[$I] = "PSBS10P" Then
            GUICtrlSetData($OutGoingProduct,$PSBS10P)
        EndIf
        If $Items[$I] = "RBPR20P" Then
            GUICtrlSetData($OutGoingProduct,$RBPR20P)
        EndIf
        If $Items[$I] = "RBRG15D" Then
            GUICtrlSetData($OutGoingProduct,$RBRG15D)
        EndIf
        If $Items[$I] = "RBRG15P" Then
            GUICtrlSetData($OutGoingProduct,$RBRG15P)
        EndIf
        If $Items[$I] = "RBRG20P" Then
            GUICtrlSetData($OutGoingProduct,$RBRG20P)
        EndIf
        If $Items[$I] = "RGGR20P" Then
            GUICtrlSetData($OutGoingProduct,$RGGR20P)
        EndIf
        If $Items[$I] = "RRPR20P" Then
            GUICtrlSetData($OutGoingProduct,$RRPR20P)
        EndIf
        If $Items[$I] = "RRRG15D" Then
            GUICtrlSetData($OutGoingProduct,$RRRG15D)
        EndIf
        If $Items[$I] = "RRRG15P" Then
            GUICtrlSetData($OutGoingProduct,$RRRG15P)
        EndIf
        If $Items[$I] = "RRRG20P" Then
            GUICtrlSetData($OutGoingProduct,$RRRG20P)
        EndIf
        If $Items[$I] = "CRCR15P" Then
            GUICtrlSetData($OutGoingProduct,$CRCR15P)
        EndIf
        If $Items[$I] = "PRRG20P" Then
            GUICtrlSetData($OutGoingProduct,$PRRG20P)
        EndIf
        
        
        
    EndIf
Next
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE,$OutgoingForm)
            GUISetState(@SW_SHOW,$InventoryMain)
            InventoryMain()
            
            
            
        Case $OutGoingProduct
    
    $SelectedProduct = GUICtrlRead($OutGoingProduct)
    If $SelectedProduct = "All Bark Cypress from Fargo GA 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"CAFA30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Royale 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"CARY30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 1.5 CuFt Double Pallet" Then
        GUICtrlSetData($OutGoingItem,"CRCR15D")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 1.5 CuFt Singles" Then
        GUICtrlSetData($OutGoingItem,"CRCR15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"CRCR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"CRCR30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Cypress 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"CRRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Classic Cedar Mulch 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"EACC30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cedar Royale 3 Cuft" Then
        GUICtrlSetData($OutGoingItem,"EACR30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cedar Rose 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"ERCR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Hardwood 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"HAPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Hardwood 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"HARG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Hardwood 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"HARG30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Select Hardwood Mulch 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"HARP20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Black Medallion 1.5 CuFt" Then
        GUICtrlSetData($OutGoingItem,"HFBM15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Black Medallion Hardwood 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"HFBM20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "N.R. Softscape Chestnut 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"NSCN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "N.R. Softscape Golden 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"NSGN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Garden Compost 1.0 CuFt" Then
        GUICtrlSetData($OutGoingItem,"OGRG10P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Garden Potting Soil 1.0 CuFt" Then
        GUICtrlSetData($OutGoingItem,"OPRG40P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Top Soil 1.0 CuFt" Then
        GUICtrlSetData($OutGoingItem,"OTRG40P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Enriched Soil Conditioner 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PCEN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Mulch 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PLFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Pine Mulch 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PLRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Mini Nug 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PMRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Nuggets 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PNFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Nuggets 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PNRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Rustic Mulch 3 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PRFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Rustic Mulch 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"PRRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Pine Straw Baled Palletized" Then
        GUICtrlSetData($OutGoingItem,"PSBS10P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Midnight Black 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"RBPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 1.5 Double Pallet" Then
        GUICtrlSetData($OutGoingItem,"RBRG15D ")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 1.5 Singles" Then
        GUICtrlSetData($OutGoingItem,"RBRG15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"RBRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Golden Rose Colored Mulch 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"RGGR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Russet Red 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"RRPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced 1.5 Double Pallet" Then
        GUICtrlSetData($OutGoingItem,"RRRG15D")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced 1.5 Singles" Then
        GUICtrlSetData($OutGoingItem,"RRRG15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Red 2 CuFt" Then
        GUICtrlSetData($OutGoingItem,"RRRG20P")
        $SelectedProduct = "null"
    EndIf
        Case $ShipLoad
            $OutGoingProduct1 = GUICtrlRead($OutGoingProduct)
            $OutGoingQuantity1 = GUICtrlRead($OutGoingQuantity)
            $NewTotal = Number(FileRead(@ScriptDir & "\Inventory\" & $OutGoingProduct1)) - Number($OutgoingQuantity1)
            If $NewTotal < 0 Then
                Msgbox(0,"WARNING","Shipping this load will cause a Paradox of unknown damage. Your inventory will hit negative numbers which isn't stable, nor supported at this time. If you wish to change this, go back to the main menu, and select 'Correct Total'")
            EndIf
            FileDelete(@ScriptDir & "\Inventory\" & $OutGoingProduct1)
            FileWrite(@ScriptDir & "\Inventory\" & $OutGoingProduct1, $NewTotal)
            $Options = IniRead(@ScriptDir & "\Options\Options.ini", "Options", "Notify", "YES" )
            If $Options = "YES" Then
            MsgBox(0,"SUCCESS",$OutGoingQuantity1 & " pallets of " & $OutGoingProduct1 & " have been shipped. Remaining = " & $NewTotal)
            EndIf
    EndSwitch
WEnd

    
EndFunc

Func IncomingMod()
Local $KEYS, $I
$Items = StringSplit("CAFA30P,CARY30P,CRCR15D,CRCR15P,CRCR20P,CRCR30P,CRRG20P,EACC30P,EACR30P,ERCR20P,HAPR20P,HARG20P,HARG30P,HARP20P,HFBM15P,HFBM20P,NSCN20P,NSGN20P,OGRG10P,OPRG40P,OTRG40P,PCEN20P,PLFP30P,PLRG20P,PMRG20P,PNFP30P,PNRG20P,PRFP30P,PRRG20P,PSBS10P,RBPR20P,RBRG15D,RBRG15P,RBRG20P,RGGR20P,RRPR20P,RRRG15D,RRRG15P,RRRG20P", ",")
$KEYS = StringSplit("30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A,5B,5C,60,61,62,63,64,65,66,67,68,69", ",")
;;;;;;;;;;;;;;;;;;;;;;;;;
$IncomingForm = GUICreate("Incoming", 722, 159, 208, 232)
$IncomingProduct = GUICtrlCreateCombo("Product", 168, 64, 249, 25)
$Group1 = GUICtrlCreateGroup("", 8, 40, 705, 73)
$IncomingQuantity = GUICtrlCreateInput("0", 472, 64, 49, 21)
GUICtrlSetLimit($IncomingQuantity, 2)
$IncomingItem = GUICtrlCreateInput("Item #", 48, 64, 89, 21,$ES_UPPERCASE)
GUICtrlSetLimit($IncomingItem,7)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ReceiveLoad = GUICtrlCreateButton("Received Load", 544, 56, 145, 41, 0)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Item #", 48, 16, 82, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
$Label2 = GUICtrlCreateLabel("Incoming", 440, 16, 108, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
GUICtrlSetColor(-1, 0x008000)
$Label4 = GUICtrlCreateLabel("Product", 240, 16, 95, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
GUICtrlSetData($IncomingProduct, "                                                                                   ")
GUICtrlSetData($IncomingProduct, "All Bark Cypress from Fargo GA 3 CuFt")
GUICtrlSetData($IncomingProduct, "Cypress Royale 3 CuFt")
GUICtrlSetData($IncomingProduct, "Cypress Rose 1.5 CuFt Double Pallet")
GUICtrlSetData($IncomingProduct, "Cypress Rose 1.5 CuFt Singles")
GUICtrlSetData($IncomingProduct, "Cypress Rose 2 CuFt")
GUICtrlSetData($IncomingProduct, "Cypress Rose 3 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Cypress 2 CuFt")
GUICtrlSetData($IncomingProduct, "Classic Cedar Mulch 3 CuFt")
GUICtrlSetData($IncomingProduct, "Cedar Royale 3 CuFt")
GUICtrlSetData($IncomingProduct, "Cedar Rose 2 CuFt")
GUICtrlSetData($IncomingProduct, "Preen Mulch Plus Hardwood 2 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Hardwood 2 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Hardwood 3 CuFt")
GUICtrlSetData($IncomingProduct, "Select Hardwood Mulch 2 CuFt")
GUICtrlSetData($IncomingProduct, "Black Medallion 1.5 CuFt")
GUICtrlSetData($IncomingProduct, "Black Medallion Hardwood 2 CuFt")
GUICtrlSetData($IncomingProduct, "N.R. Softscape Chestnut 2 CuFt")
GUICtrlSetData($IncomingProduct, "N.R. Softscape Golden 2 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Garden Compost 1.0 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Garden Potting Soil 1.0 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Top Soil 1.0 CuFt")
GUICtrlSetData($IncomingProduct, "Enriched Soil Conditioner 2 CuFt")
GUICtrlSetData($IncomingProduct, "Forest Pine Mulch 3 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Pine Mulch 2 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Mini Nug 2 CuFt")
GUICtrlSetData($IncomingProduct, "Forest Pine Nuggets 3 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Nuggets 2 CuFt")
GUICtrlSetData($IncomingProduct, "Forest Pine Rustic Mulch 3 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Rustic Mulch 2 CuFt")
GUICtrlSetData($IncomingProduct, "Pine Straw Baled Palletized")
GUICtrlSetData($IncomingProduct, "Preen Mulch Plus Midnight Black 2 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Color Enhanced Black 1.5 Double Pallet")
GUICtrlSetData($IncomingProduct, "Royal Gardens Color Enhanced Black 1.5 Singles")
GUICtrlSetData($IncomingProduct, "Royal Gardens Color Enhanced Black 2 CuFt")
GUICtrlSetData($IncomingProduct, "Golden Rose Colored Mulch 2 CuFt")
GUICtrlSetData($IncomingProduct, "Preen Mulch Plus Russet Red 2 CuFt")
GUICtrlSetData($IncomingProduct, "Royal Gardens Color Enhanced 1.5 Double Pallet")
GUICtrlSetData($IncomingProduct, "Royal Gardens Color Enhanced 1.5 Singles")
GUICtrlSetData($IncomingProduct, "Royal Gardens Color Enhanced Red 2 CuFt")
GUISetState(@SW_SHOW,$IncomingForm)
#EndRegion ### END Koda GUI section ###

While 1
    $ItemSearch = "null"
; Key down script start
  For $I = 1 To $KEYS[0]
    If _IsPressed ($KEYS[$I]) Then
        $ItemSearch = GUICtrlRead($IncomingItem)
    EndIf
Next
; Key down Scripty ended *Thanks Klaatu!
For $I = 1 To $Items[0]
    If $ItemSearch = ($Items[$I]) Then
$CAFA30P = "All Bark Cypress from Fargo GA 3 CuFt"
$CARY30P = "Cypress Royale 3 CuFt"
$CRCR15D = "Cypress Rose 1.5 CuFt Double Pallet"
$CRCR15P = "Cypress Rose 1.5 CuFt Singles"
$CRCR20P = "Cypress Rose 2 CuFt"
$CRCR30P = "Cypress Rose 3 CuFt"
$CRRG20P = "Royal Gardens Cypress 2 CuFt"
$EACC30P = "Classic Cedar Mulch 3 CuFt"
$EACR30P = "Cedar Royale 3 Cuft"
$ERCR20P = "Cedar Rose 2 CuFt"
$HAPR20P = "Preen Mulch Plus Hardwood 2 CuFt"
$HARG20P = "Royal Gardens Hardwood 2 CuFt"
$HARG30P = "Royal Gardens Hardwood 3 CuFt"
$HARP20P = "Select Hardwood Mulch 2 CuFt"
$HFBM15P = "Black Medallion 1.5 CuFt"
$HFBM20P = "Black Medallion Hardwood 2 CuFt"
$NSCN20P = "N.R. Softscape Chestnut 2 CuFt"
$NSGN20P = "N.R. Softscape Golden 2 CuFt"
$OGRG10P = "Royal Garden Compost 1.0 CuFt"
$OPRG40P = "Royal Garden Potting Soil 1.0 CuFt"
$OTRG40P = "Royal Gardens Top Soil 1.0 CuFt"
$PCEN20P = "Enriched Soil Conditioner 2 CuFt"
$PLFP30P = "Forest Pine Mulch 3 CuFt"
$PLRG20P = "Royal Gardens Pine Mulch 2 CuFt"
$PMRG20P = "Royal Gardens Mini Nug 2 CuFt"
$PNFP30P = "Forest Pine Nuggets 3 CuFt"
$PNRG20P = "Royal Gardens Nuggets 2 CuFt"
$PRFP30P = "Forest Pine Rustic Mulch 3 CuFt"
$PRRG20P = "Royal Gardens Rustic Mulch 2 CuFt"
$PSBS10P = "Pine Straw Baled Palletized"
$RBPR20P = "Preen Mulch Plus Midnight Black 2 CuFt"
$RBRG15D = "Royal Gardens Color Enhanced Black 1.5 Double Pallet"
$RBRG15P = "Royal Gardens Color Enhanced Black 1.5 Singles"
$RBRG20P = "Royal Gardens Color Enhanced Black 2 CuFt"
$RGGR20P = "Golden Rose Colored Mulch 2 CuFt"
$RRPR20P = "Preen Mulch Plus Russet Red 2 CuFt"
$RRRG15D = "Royal Gardens Color Enhanced 1.5 Double Pallet"
$RRRG15P = "Royal Gardens Color Enhanced 1.5 Singles"
$RRRG20P = "Royal Gardens Color Enhanced Red 2 CuFt"

        If $Items[$I] = "CAFA30P" Then
            GUICtrlSetData($IncomingProduct,$CAFA30P)
        EndIf
        If $Items[$I] = "CARY30P" Then
            GUICtrlSetData($IncomingProduct,$CARY30P)
        EndIf
        If $Items[$I] = "CRCR15D" Then
            GUICtrlSetData($IncomingProduct,$CRCR15D)
        EndIf
        If $Items[$I] = "CRCR20P" Then
            GUICtrlSetData($IncomingProduct,$CRCR20P)
        EndIf
        If $Items[$I] = "CRCR30P" Then
            GUICtrlSetData($IncomingProduct,$CRCR30P)
        EndIf
        If $Items[$I] = "CRRG20P" Then
            GUICtrlSetData($IncomingProduct,$CRRG20P)
        EndIf
        If $Items[$I] = "EACC30P" Then
            GUICtrlSetData($IncomingProduct,$EACC30P)
        EndIf
        If $Items[$I] = "EACR30P" Then
            GUICtrlSetData($IncomingProduct,$EACR30P)
        EndIf
        If $Items[$I] = "ERCR20P" Then
            GUICtrlSetData($IncomingProduct,$ERCR20P)
        EndIf
        If $Items[$I] = "HAPR20P" Then
            GUICtrlSetData($IncomingProduct,$HAPR20P)
        EndIf
        If $Items[$I] = "HARG20P" Then
            GUICtrlSetData($IncomingProduct,$HARG20P)
        EndIf
        If $Items[$I] = "HARG30P" Then
            GUICtrlSetData($IncomingProduct,$HARG30P)
        EndIf
        If $Items[$I] = "HARP20P" Then
            GUICtrlSetData($IncomingProduct,$HARP20P)
        EndIf
        If $Items[$I] = "HFBM15P" Then
            GUICtrlSetData($IncomingProduct,$HFBM15P)
        EndIf
        If $Items[$I] = "HFBM20P" Then
            GUICtrlSetData($IncomingProduct,$HFBM20P)
        EndIf
        If $Items[$I] = "NSCN20P" Then
            GUICtrlSetData($IncomingProduct,$NSCN20P)
        EndIf
        If $Items[$I] = "NSGN20P" Then
            GUICtrlSetData($IncomingProduct,$NSGN20P)
        EndIf
        If $Items[$I] = "OGRG10P" Then
            GUICtrlSetData($IncomingProduct,$OGRG10P)
        EndIf
        If $Items[$I] = "OPRG40P" Then
            GUICtrlSetData($IncomingProduct,$OPRG40P)
        EndIf
        If $Items[$I] = "OTRG40P" Then
            GUICtrlSetData($IncomingProduct,$OTRG40P)
        EndIf
        If $Items[$I] = "PCEN20P" Then
            GUICtrlSetData($IncomingProduct,$PCEN20P)
        EndIf
        If $Items[$I] = "PLFP30P" Then
            GUICtrlSetData($IncomingProduct,$PLFP30P)
        EndIf
        If $Items[$I] = "PLRG20P" Then
            GUICtrlSetData($IncomingProduct,$PLRG20P)
        EndIf
        If $Items[$I] = "PMRG20P" Then
            GUICtrlSetData($IncomingProduct,$PMRG20P)
        EndIf
        If $Items[$I] = "PNFP30P" Then
            GUICtrlSetData($IncomingProduct,$PNFP30P)
        EndIf
        If $Items[$I] = "PNRG20P" Then
            GUICtrlSetData($IncomingProduct,$PNRG20P)
        EndIf
        If $Items[$I] = "PRFP30P" Then
            GUICtrlSetData($IncomingProduct,$PRFP30P)
        EndIf
        If $Items[$I] = "PSBS10P" Then
            GUICtrlSetData($IncomingProduct,$PSBS10P)
        EndIf
        If $Items[$I] = "RBPR20P" Then
            GUICtrlSetData($IncomingProduct,$RBPR20P)
        EndIf
        If $Items[$I] = "RBRG15D" Then
            GUICtrlSetData($IncomingProduct,$RBRG15D)
        EndIf
        If $Items[$I] = "RBRG15P" Then
            GUICtrlSetData($IncomingProduct,$RBRG15P)
        EndIf
        If $Items[$I] = "RBRG20P" Then
            GUICtrlSetData($IncomingProduct,$RBRG20P)
        EndIf
        If $Items[$I] = "RGGR20P" Then
            GUICtrlSetData($IncomingProduct,$RGGR20P)
        EndIf
        If $Items[$I] = "RRPR20P" Then
            GUICtrlSetData($IncomingProduct,$RRPR20P)
        EndIf
        If $Items[$I] = "RRRG15D" Then
            GUICtrlSetData($IncomingProduct,$RRRG15D)
        EndIf
        If $Items[$I] = "RRRG15P" Then
            GUICtrlSetData($IncomingProduct,$RRRG15P)
        EndIf
        If $Items[$I] = "RRRG20P" Then
            GUICtrlSetData($IncomingProduct,$RRRG20P)
        EndIf
        If $Items[$I] = "CRCR15P" Then
            GUICtrlSetData($IncomingProduct,$CRCR15P)
        EndIf
        If $Items[$I] = "PRRG20P" Then
            GUICtrlSetData($IncomingProduct,$PRRG20P)
        EndIf
        
    EndIf
Next
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE,$IncomingForm)
            GUISetState(@SW_SHOW,$InventoryMain)
            InventoryMain()

        Case $IncomingProduct
    
    $SelectedProduct = GUICtrlRead($IncomingProduct)
    If $SelectedProduct = "All Bark Cypress from Fargo GA 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"CAFA30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Royale 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"CARY30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 1.5 CuFt Double Pallet" Then
        GUICtrlSetData($IncomingItem,"CRCR15D")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 1.5 CuFt Singles" Then
        GUICtrlSetData($IncomingItem,"CRCR15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"CRCR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"CRCR30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Cypress 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"CRRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Classic Cedar Mulch 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"EACC30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cedar Royale 3 Cuft" Then
        GUICtrlSetData($IncomingItem,"EACR30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cedar Rose 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"ERCR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Hardwood 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"HAPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Hardwood 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"HARG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Hardwood 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"HARG30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Select Hardwood Mulch 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"HARP20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Black Medallion 1.5 CuFt" Then
        GUICtrlSetData($IncomingItem,"HFBM15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Black Medallion Hardwood 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"HFBM20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "N.R. Softscape Chestnut 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"NSCN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "N.R. Softscape Golden 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"NSGN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Garden Compost 1.0 CuFt" Then
        GUICtrlSetData($IncomingItem,"OGRG10P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Garden Potting Soil 1.0 CuFt" Then
        GUICtrlSetData($IncomingItem,"OPRG40P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Top Soil 1.0 CuFt" Then
        GUICtrlSetData($IncomingItem,"OTRG40P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Enriched Soil Conditioner 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"PCEN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Mulch 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"PLFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Pine Mulch 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"PLRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Mini Nug 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"PMRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Nuggets 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"PNFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Nuggets 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"PNRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Rustic Mulch 3 CuFt" Then
        GUICtrlSetData($IncomingItem,"PRFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Rustic Mulch 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"PRRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Pine Straw Baled Palletized" Then
        GUICtrlSetData($IncomingItem,"PSBS10P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Midnight Black 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"RBPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 1.5 Double Pallet" Then
        GUICtrlSetData($IncomingItem,"RBRG15D ")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 1.5 Singles" Then
        GUICtrlSetData($IncomingItem,"RBRG15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"RBRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Golden Rose Colored Mulch 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"RGGR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Russet Red 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"RRPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced 1.5 Double Pallet" Then
        GUICtrlSetData($IncomingItem,"RRRG15D")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced 1.5 Singles" Then
        GUICtrlSetData($IncomingItem,"RRRG15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Red 2 CuFt" Then
        GUICtrlSetData($IncomingItem,"RRRG20P")
        $SelectedProduct = "null"
    EndIf
        Case $IncomingQuantity
        Case $IncomingItem
        Case $ReceiveLoad
            
            $IncomingProduct1 = GUICtrlRead($IncomingProduct)
            $IncomingQuantity1 = GUICtrlRead($IncomingQuantity)
            $NewTotal = Number(FileRead(@ScriptDir & "\Inventory\" & $IncomingProduct1)) + Number($IncomingQuantity1)
            FileDelete(@ScriptDir & "\Inventory\" & $IncomingProduct1)
            FileWrite(@ScriptDir & "\Inventory\" & $IncomingProduct1, $NewTotal)
            $Options = IniRead(@ScriptDir & "\Options\Options.ini", "Options", "Notify", "YES" )
            If $Options = "YES" Then
            MsgBox(0,"SUCCESS",$IncomingQuantity1 & " pallets of " & $IncomingProduct1 & " have been received. Total = " & $NewTotal)
            EndIf
    EndSwitch
WEnd

EndFunc

Func UnusableBin()
Local $KEYS, $I
$Items = StringSplit("CAFA30P,CARY30P,CRCR15D,CRCR15P,CRCR20P,CRCR30P,CRRG20P,EACC30P,EACR30P,ERCR20P,HAPR20P,HARG20P,HARG30P,HARP20P,HFBM15P,HFBM20P,NSCN20P,NSGN20P,OGRG10P,OPRG40P,OTRG40P,PCEN20P,PLFP30P,PLRG20P,PMRG20P,PNFP30P,PNRG20P,PRFP30P,PRRG20P,PSBS10P,RBPR20P,RBRG15D,RBRG15P,RBRG20P,RGGR20P,RRPR20P,RRRG15D,RRRG15P,RRRG20P", ",")
$KEYS = StringSplit("30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,4A,4B,4C,4D,4E,4F,50,51,52,53,54,55,56,57,58,59,5A,5B,5C,60,61,62,63,64,65,66,67,68,69", ",")
;;;;;;;;;;;;;;;;;;;;;;;;;
$UnusableForm = GUICreate("Collateral Damage", 721, 156, 331, 229)
$UnusableProduct = GUICtrlCreateCombo("Product", 168, 64, 249, 25)
$Group1 = GUICtrlCreateGroup("", 8, 40, 705, 73)
$UnusableQuantity = GUICtrlCreateInput("0", 472, 64, 49, 21)
GUICtrlSetLimit(-1, 2)
$UnusableItem = GUICtrlCreateInput("Item #", 48, 64, 89, 21,$ES_UPPERCASE)
GUICtrlSetLimit($UnusableItem, 7)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$AddUnusable = GUICtrlCreateButton("Add to Unusable Bin", 544, 56, 145, 41, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Serif")
$Label1 = GUICtrlCreateLabel("Item #", 48, 16, 82, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
$Label2 = GUICtrlCreateLabel("Unusable Bin", 424, 16, 160, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
GUICtrlSetColor(-1, 0x008000)
$Label4 = GUICtrlCreateLabel("Product", 240, 16, 95, 24)
GUICtrlSetFont(-1, 15, 800, 0, "Courier")
$Mold = GUICtrlCreateCheckbox("Mold/Mildew Damage", 40, 128, 225, 17)
GUICtrlSetFont(-1, 12, 800, 0, "Courier")
$AgeSun = GUICtrlCreateCheckbox("Age/Sun Damage", 280, 128, 177, 17)
GUICtrlSetFont(-1, 12, 800, 0, "Courier")
$ToreBags = GUICtrlCreateCheckbox("Tore Bags", 472, 128, 225, 17)
GUICtrlSetFont(-1, 12, 800, 0, "Courier")
GUICtrlSetData($UnusableProduct, "                                                                                   ")
GUICtrlSetData($UnusableProduct, "All Bark Cypress from Fargo GA 3 CuFt")
GUICtrlSetData($UnusableProduct, "Cypress Royale 3 CuFt")
GUICtrlSetData($UnusableProduct, "Cypress Rose 1.5 CuFt Double Pallet")
GUICtrlSetData($UnusableProduct, "Cypress Rose 1.5 CuFt Singles")
GUICtrlSetData($UnusableProduct, "Cypress Rose 2 CuFt")
GUICtrlSetData($UnusableProduct, "Cypress Rose 3 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Cypress 2 CuFt")
GUICtrlSetData($UnusableProduct, "Classic Cedar Mulch 3 CuFt")
GUICtrlSetData($UnusableProduct, "Cedar Royale 3 CuFt")
GUICtrlSetData($UnusableProduct, "Cedar Rose 2 CuFt")
GUICtrlSetData($UnusableProduct, "Preen Mulch Plus Hardwood 2 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Hardwood 2 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Hardwood 3 CuFt")
GUICtrlSetData($UnusableProduct, "Select Hardwood Mulch 2 CuFt")
GUICtrlSetData($UnusableProduct, "Black Medallion 1.5 CuFt")
GUICtrlSetData($UnusableProduct, "Black Medallion Hardwood 2 CuFt")
GUICtrlSetData($UnusableProduct, "N.R. Softscape Chestnut 2 CuFt")
GUICtrlSetData($UnusableProduct, "N.R. Softscape Golden 2 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Garden Compost 1.0 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Garden Potting Soil 1.0 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Top Soil 1.0 CuFt")
GUICtrlSetData($UnusableProduct, "Enriched Soil Conditioner 2 CuFt")
GUICtrlSetData($UnusableProduct, "Forest Pine Mulch 3 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Pine Mulch 2 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Mini Nug 2 CuFt")
GUICtrlSetData($UnusableProduct, "Forest Pine Nuggets 3 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Nuggets 2 CuFt")
GUICtrlSetData($UnusableProduct, "Forest Pine Rustic Mulch 3 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Rustic Mulch 2 CuFt")
GUICtrlSetData($UnusableProduct, "Pine Straw Baled Palletized")
GUICtrlSetData($UnusableProduct, "Preen Mulch Plus Midnight Black 2 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Color Enhanced Black 1.5 Double Pallet")
GUICtrlSetData($UnusableProduct, "Royal Gardens Color Enhanced Black 1.5 Singles")
GUICtrlSetData($UnusableProduct, "Royal Gardens Color Enhanced Black 2 CuFt")
GUICtrlSetData($UnusableProduct, "Golden Rose Colored Mulch 2 CuFt")
GUICtrlSetData($UnusableProduct, "Preen Mulch Plus Russet Red 2 CuFt")
GUICtrlSetData($UnusableProduct, "Royal Gardens Color Enhanced 1.5 Double Pallet")
GUICtrlSetData($UnusableProduct, "Royal Gardens Color Enhanced 1.5 Singles")
GUICtrlSetData($UnusableProduct, "Royal Gardens Color Enhanced Red 2 CuFt")
GUISetState(@SW_SHOW,$UnusableForm)

While 1
        $ItemSearch = "null"
; Key down script start
  For $I = 1 To $KEYS[0]
    If _IsPressed ($KEYS[$I]) Then
        $ItemSearch = GUICtrlRead($UnusableItem)
    EndIf
Next
; Key down Scripty ended *Thanks Klaatu!
For $I = 1 To $Items[0]
    If $ItemSearch = ($Items[$I]) Then
$CAFA30P = "All Bark Cypress from Fargo GA 3 CuFt"
$CARY30P = "Cypress Royale 3 CuFt"
$CRCR15D = "Cypress Rose 1.5 CuFt Double Pallet"
$CRCR15P = "Cypress Rose 1.5 CuFt Singles"
$CRCR20P = "Cypress Rose 2 CuFt"
$CRCR30P = "Cypress Rose 3 CuFt"
$CRRG20P = "Royal Gardens Cypress 2 CuFt"
$EACC30P = "Classic Cedar Mulch 3 CuFt"
$EACR30P = "Cedar Royale 3 Cuft"
$ERCR20P = "Cedar Rose 2 CuFt"
$HAPR20P = "Preen Mulch Plus Hardwood 2 CuFt"
$HARG20P = "Royal Gardens Hardwood 2 CuFt"
$HARG30P = "Royal Gardens Hardwood 3 CuFt"
$HARP20P = "Select Hardwood Mulch 2 CuFt"
$HFBM15P = "Black Medallion 1.5 CuFt"
$HFBM20P = "Black Medallion Hardwood 2 CuFt"
$NSCN20P = "N.R. Softscape Chestnut 2 CuFt"
$NSGN20P = "N.R. Softscape Golden 2 CuFt"
$OGRG10P = "Royal Garden Compost 1.0 CuFt"
$OPRG40P = "Royal Garden Potting Soil 1.0 CuFt"
$OTRG40P = "Royal Gardens Top Soil 1.0 CuFt"
$PCEN20P = "Enriched Soil Conditioner 2 CuFt"
$PLFP30P = "Forest Pine Mulch 3 CuFt"
$PLRG20P = "Royal Gardens Pine Mulch 2 CuFt"
$PMRG20P = "Royal Gardens Mini Nug 2 CuFt"
$PNFP30P = "Forest Pine Nuggets 3 CuFt"
$PNRG20P = "Royal Gardens Nuggets 2 CuFt"
$PRFP30P = "Forest Pine Rustic Mulch 3 CuFt"
$PRRG20P = "Royal Gardens Rustic Mulch 2 CuFt"
$PSBS10P = "Pine Straw Baled Palletized"
$RBPR20P = "Preen Mulch Plus Midnight Black 2 CuFt"
$RBRG15D = "Royal Gardens Color Enhanced Black 1.5 Double Pallet"
$RBRG15P = "Royal Gardens Color Enhanced Black 1.5 Singles"
$RBRG20P = "Royal Gardens Color Enhanced Black 2 CuFt"
$RGGR20P = "Golden Rose Colored Mulch 2 CuFt"
$RRPR20P = "Preen Mulch Plus Russet Red 2 CuFt"
$RRRG15D = "Royal Gardens Color Enhanced 1.5 Double Pallet"
$RRRG15P = "Royal Gardens Color Enhanced 1.5 Singles"
$RRRG20P = "Royal Gardens Color Enhanced Red 2 CuFt"

        If $Items[$I] = "CAFA30P" Then
            GUICtrlSetData($UnusableProduct,$CAFA30P)
        EndIf
        If $Items[$I] = "CARY30P" Then
            GUICtrlSetData($UnusableProduct,$CARY30P)
        EndIf
        If $Items[$I] = "CRCR15D" Then
            GUICtrlSetData($UnusableProduct,$CRCR15D)
        EndIf
        If $Items[$I] = "CRCR20P" Then
            GUICtrlSetData($UnusableProduct,$CRCR20P)
        EndIf
        If $Items[$I] = "CRCR30P" Then
            GUICtrlSetData($UnusableProduct,$CRCR30P)
        EndIf
        If $Items[$I] = "CRRG20P" Then
            GUICtrlSetData($UnusableProduct,$CRRG20P)
        EndIf
        If $Items[$I] = "EACC30P" Then
            GUICtrlSetData($UnusableProduct,$EACC30P)
        EndIf
        If $Items[$I] = "EACR30P" Then
            GUICtrlSetData($UnusableProduct,$EACR30P)
        EndIf
        If $Items[$I] = "ERCR20P" Then
            GUICtrlSetData($UnusableProduct,$ERCR20P)
        EndIf
        If $Items[$I] = "HAPR20P" Then
            GUICtrlSetData($UnusableProduct,$HAPR20P)
        EndIf
        If $Items[$I] = "HARG20P" Then
            GUICtrlSetData($UnusableProduct,$HARG20P)
        EndIf
        If $Items[$I] = "HARG30P" Then
            GUICtrlSetData($UnusableProduct,$HARG30P)
        EndIf
        If $Items[$I] = "HARP20P" Then
            GUICtrlSetData($UnusableProduct,$HARP20P)
        EndIf
        If $Items[$I] = "HFBM15P" Then
            GUICtrlSetData($UnusableProduct,$HFBM15P)
        EndIf
        If $Items[$I] = "HFBM20P" Then
            GUICtrlSetData($UnusableProduct,$HFBM20P)
        EndIf
        If $Items[$I] = "NSCN20P" Then
            GUICtrlSetData($UnusableProduct,$NSCN20P)
        EndIf
        If $Items[$I] = "NSGN20P" Then
            GUICtrlSetData($UnusableProduct,$NSGN20P)
        EndIf
        If $Items[$I] = "OGRG10P" Then
            GUICtrlSetData($UnusableProduct,$OGRG10P)
        EndIf
        If $Items[$I] = "OPRG40P" Then
            GUICtrlSetData($UnusableProduct,$OPRG40P)
        EndIf
        If $Items[$I] = "OTRG40P" Then
            GUICtrlSetData($UnusableProduct,$OTRG40P)
        EndIf
        If $Items[$I] = "PCEN20P" Then
            GUICtrlSetData($UnusableProduct,$PCEN20P)
        EndIf
        If $Items[$I] = "PLFP30P" Then
            GUICtrlSetData($UnusableProduct,$PLFP30P)
        EndIf
        If $Items[$I] = "PLRG20P" Then
            GUICtrlSetData($UnusableProduct,$PLRG20P)
        EndIf
        If $Items[$I] = "PMRG20P" Then
            GUICtrlSetData($UnusableProduct,$PMRG20P)
        EndIf
        If $Items[$I] = "PNFP30P" Then
            GUICtrlSetData($UnusableProduct,$PNFP30P)
        EndIf
        If $Items[$I] = "PNRG20P" Then
            GUICtrlSetData($UnusableProduct,$PNRG20P)
        EndIf
        If $Items[$I] = "PRFP30P" Then
            GUICtrlSetData($UnusableProduct,$PRFP30P)
        EndIf
        If $Items[$I] = "PSBS10P" Then
            GUICtrlSetData($UnusableProduct,$PSBS10P)
        EndIf
        If $Items[$I] = "RBPR20P" Then
            GUICtrlSetData($UnusableProduct,$RBPR20P)
        EndIf
        If $Items[$I] = "RBRG15D" Then
            GUICtrlSetData($UnusableProduct,$RBRG15D)
        EndIf
        If $Items[$I] = "RBRG15P" Then
            GUICtrlSetData($UnusableProduct,$RBRG15P)
        EndIf
        If $Items[$I] = "RBRG20P" Then
            GUICtrlSetData($UnusableProduct,$RBRG20P)
        EndIf
        If $Items[$I] = "RGGR20P" Then
            GUICtrlSetData($UnusableProduct,$RGGR20P)
        EndIf
        If $Items[$I] = "RRPR20P" Then
            GUICtrlSetData($UnusableProduct,$RRPR20P)
        EndIf
        If $Items[$I] = "RRRG15D" Then
            GUICtrlSetData($UnusableProduct,$RRRG15D)
        EndIf
        If $Items[$I] = "RRRG15P" Then
            GUICtrlSetData($UnusableProduct,$RRRG15P)
        EndIf
        If $Items[$I] = "RRRG20P" Then
            GUICtrlSetData($UnusableProduct,$RRRG20P)
        EndIf
        If $Items[$I] = "CRCR15P" Then
            GUICtrlSetData($UnusableProduct,$CRCR15P)
        EndIf
        If $Items[$I] = "PRRG20P" Then
            GUICtrlSetData($UnusableProduct,$PRRG20P)
        EndIf
        
    EndIf
Next
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE,$UnusableForm)
            GUISetState(@SW_SHOW,$InventoryMain)
            InventoryMain()

    Case $UnusableProduct
    $SelectedProduct = GUICtrlRead($UnusableProduct)
    If $SelectedProduct = "All Bark Cypress from Fargo GA 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"CAFA30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Royale 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"CARY30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 1.5 CuFt Double Pallet" Then
        GUICtrlSetData($UnusableItem,"CRCR15D")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 1.5 CuFt Singles" Then
        GUICtrlSetData($UnusableItem,"CRCR15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"CRCR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cypress Rose 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"CRCR30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Cypress 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"CRRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Classic Cedar Mulch 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"EACC30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cedar Royale 3 Cuft" Then
        GUICtrlSetData($UnusableItem,"EACR30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Cedar Rose 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"ERCR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Hardwood 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"HAPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Hardwood 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"HARG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Hardwood 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"HARG30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Select Hardwood Mulch 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"HARP20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Black Medallion 1.5 CuFt" Then
        GUICtrlSetData($UnusableItem,"HFBM15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Black Medallion Hardwood 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"HFBM20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "N.R. Softscape Chestnut 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"NSCN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "N.R. Softscape Golden 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"NSGN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Garden Compost 1.0 CuFt" Then
        GUICtrlSetData($UnusableItem,"OGRG10P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Garden Potting Soil 1.0 CuFt" Then
        GUICtrlSetData($UnusableItem,"OPRG40P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Top Soil 1.0 CuFt" Then
        GUICtrlSetData($UnusableItem,"OTRG40P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Enriched Soil Conditioner 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"PCEN20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Mulch 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"PLFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Pine Mulch 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"PLRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Mini Nug 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"PMRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Nuggets 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"PNFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Nuggets 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"PNRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Forest Pine Rustic Mulch 3 CuFt" Then
        GUICtrlSetData($UnusableItem,"PRFP30P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Rustic Mulch 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"PRRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Pine Straw Baled Palletized" Then
        GUICtrlSetData($UnusableItem,"PSBS10P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Midnight Black 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"RBPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 1.5 Double Pallet" Then
        GUICtrlSetData($UnusableItem,"RBRG15D ")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 1.5 Singles" Then
        GUICtrlSetData($UnusableItem,"RBRG15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Black 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"RBRG20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Golden Rose Colored Mulch 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"RGGR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Preen Mulch Plus Russet Red 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"RRPR20P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced 1.5 Double Pallet" Then
        GUICtrlSetData($UnusableItem,"RRRG15D")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced 1.5 Singles" Then
        GUICtrlSetData($UnusableItem,"RRRG15P")
        $SelectedProduct = "null"
    EndIf
    If $SelectedProduct = "Royal Gardens Color Enhanced Red 2 CuFt" Then
        GUICtrlSetData($UnusableItem,"RRRG20P")
        $SelectedProduct = "null"
    EndIf
    
    
        Case $AddUnusable
            $MoldBox = GUICtrlRead($Mold)
            $AgeSunBox = GUICtrlRead($AgeSun)
            $ToreBagsBox = GUICtrlRead($ToreBags)
            $UnusableProduct1 = GUICtrlRead($UnusableProduct)
            $UnusableQuantity1 = GUICtrlRead($UnusableQuantity)
            If $MoldBox = 1 Then
                If $AgeSunBox = 1 Then
                    If $ToreBagsBox = 1 Then
                        $NewTotal = Number(IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","MAT",$UnusableProduct1,"0")) + Number($UnusableQuantity1)
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","MAT",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
            
            If $MoldBox = 1 Then
                If $AgeSunBox = 1 Then
                    If Not $ToreBagsBox = 1 Then
                        $OldTotal = IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","MA",$UnusableProduct1,"0")
                        $NewTotal = $OldTotal + $UnusableQuantity1
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","MA",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
            
            If $MoldBox = 1 Then
                If $ToreBagsBox = 1 Then
                    If Not $AgeSunBox = 1 Then
                        $OldTotal = IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","MT",$UnusableProduct1,"0")
                        $NewTotal = $OldTotal + $UnusableQuantity1
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","MT",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
            
            If $AgeSunBox = 1 Then
                If $ToreBagsBox = 1 Then
                    If Not $MoldBox = 1 Then
                        $OldTotal = IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","AT",$UnusableProduct1,"0")
                        $NewTotal = $OldTotal + $UnusableQuantity1
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","AT",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
            
            If $MoldBox = 1 Then
                If Not $AgeSunBox = 1 Then
                    If Not $ToreBagsBox = 1 Then
                        $OldTotal = IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","M",$UnusableProduct1,"0")
                        $NewTotal = $OldTotal + $UnusableQuantity1
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","M",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
            
            If $AgeSunBox = 1 Then
                If Not $MoldBox = 1 Then
                    If Not $ToreBagsBox = 1 Then
                        $OldTotal = IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","A",$UnusableProduct1,"0")
                        $NewTotal = $OldTotal + $UnusableQuantity1
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","A",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
                    
            If $ToreBagsBox = 1 Then
                If Not $AgeSunBox = 1 Then
                    If Not $MoldBox = 1 Then
                        $OldTotal = IniRead(@ScriptDir & "\Inventory\Unusable\Unusable.ini","T",$UnusableProduct1,"0")
                        $NewTotal = $OldTotal + $UnusableQuantity1
                        IniWrite(@ScriptDir & "\Inventory\Unusable\Unusable.ini","T",$UnusableProduct1,$NewTotal)
                    EndIf
                EndIf
            EndIf
            
            $OldTotal = FileRead(@ScriptDir & "\Inventory\Unusable\" & $UnusableProduct1)
            $NewTotal = $OldTotal + $UnusableQuantity1
            $Options = IniRead(@ScriptDir & "\Options\Options.ini","Options","Notify","YES")
            If $Options = "YES" Then
                MsgBox(0,"SUCCESS",$UnusableQuantity1 & " pallets of " & $UnusableProduct1 & " has been reported. Total: " & $NewTotal)
            EndIf
    EndSwitch
WEnd

EndFunc

Share this post


Link to post
Share on other sites



Read up on arrays and loop statements (For...To...Step...Next, While...WEnd, Do...Until) in the help file. You can get rid of the repetitive If statements by looping through an array of variables with a single If statement inside the loop.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

For some reason my edit isn't working, seriously... I know the forum rules, and I'm not trying to bump... My topic is at the top right as this second anyways.

Just another quick question... Variables declared inside a function, will not work outside that function, right? What about variables declared globally, like before a function, will they work inside the next function?

Reply Airwolf;

I know about Arrays, but when it comes to searching through them, and outputting data, unless I specify the exact array in a statement... It confuses me... One of the most essential parts of programming (For...To...Step...Next) just fries my brain... but like most other things, once I completely understand it, I guess it will just click, and I'll start using it... lol. It just kinda tee's me off that when I was 11 years old, I could code better in Visual Basic, than I can AutoIt now...lol

P.S. Edit decides to work on this one...

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

Variables declared inside a function, will not work outside that function, right?

Correct - if they are declared Dim or Local (if you don't specify, Dim is default - which is local when inside a function).

What about variables declared globally, like before a function, will they work inside the next function?

If you declare a variable globally, you can change it inside functions. Just try to stay away from declaring global variables inside of functions - that can cause problems.

Reply Airwolf;

I know about Arrays, but when it comes to searching through them, and outputting data, unless I specify the exact array in a statement... It confuses me... One of the most essential parts of programming (For...To...Step...Next) just fries my brain... but like most other things, once I completely understand it, I guess it will just click, and I'll start using it... lol. It just kinda tee's me off that when I was 11 years old, I could code better in Visual Basic, than I can AutoIt now...lol

It actually looks like you may be better off keeping a lot of the string data in a database. You could then pull the data out based on the database structure. I see a lot of repetition with string variables such as "Royal Gardens Cypress 2 CuFt". You can simply create an XLS document and pull the data out with the ExcelCOM UDF library - this would cleanup the code quite a bit. You'll still need to grasp the For...Next concept. I know it's frustrating, but try reading through the help documentation and searching around the forums for examples. I'd cleanup the code for you, but I don't have enough time on my hands at the moment.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

Correct - if they are declared Dim or Local (if you don't specify, Dim is default - which is local when inside a function).

If you declare a variable globally, you can change it inside functions. Just try to stay away from declaring global variables inside of functions - that can cause problems.

It actually looks like you may be better off keeping a lot of the string data in a database. You could then pull the data out based on the database structure. I see a lot of repetition with string variables such as "Royal Gardens Cypress 2 CuFt". You can simply create an XLS document and pull the data out with the ExcelCOM UDF library - this would cleanup the code quite a bit. You'll still need to grasp the For...Next concept. I know it's frustrating, but try reading through the help documentation and searching around the forums for examples. I'd cleanup the code for you, but I don't have enough time on my hands at the moment.

Wow, Airwolf... I really didn't expect such helpful advise over code this sloppy... Thanks a lot! I'll do my best and study up on "For...Next" a little more. About cleaning it up yourself, that's a real kind gesture, but I'm not expecting that from anyone, just for the record... But thanks for that statement. Makes a user feel more cozy here... lol

Share this post


Link to post
Share on other sites

Wow, Airwolf... I really didn't expect such helpful advise over code this sloppy... Thanks a lot! I'll do my best and study up on "For...Next" a little more. About cleaning it up yourself, that's a real kind gesture, but I'm not expecting that from anyone, just for the record... But thanks for that statement. Makes a user feel more cozy here... lol

For the record, I don't think your code is very "sloppy". It may be a little more simplistic, and therefore lengthy, than it could be... but the structure isn't bad.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

For the record, I don't think your code is very "sloppy". It may be a little more simplistic, and therefore lengthy, than it could be... but the structure isn't bad.

One of these days, I'm going to add all the GUI's into one interface, or one block of code (better yet), and get rid of all the different functions, and change it all over to 'CASE' switches... :mellow: But as you can see, that's going to require almost a complete re-write... :)

P.S. Anyone know of any compatibility issues with AutoIt in Windows 7 yet? I'm about to give it a try, as I've finally acquired a confirmed, legal, copy, of Windows 7, and may be switching before long... :( Also, I may not be so good at AutoIt, but I am aware of Windows 7 still being in the Beta, or development stages, and the problems that can bring... ;)

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

Hey Binary...

I wouldnt say my code in AutoIt is all that great either. However, over time I know that it has improved with various techniques I have learned right here on this site. So, keep up the great work. In looking at your code, you are likely right that you will have to do a bit of rewriting to optimize or make your code more efficient (and/or readable).

When I write code (AutoIt or otherwise) I try to break it up into chunks that are logically separate. I may start with linear code like you have here, but then wrap groupings of code and put it within a function. If, for example, you have a block of code that is doing a job but is not manipulating variables (ex. setting up a gui), then you can put that block within a function and call it. I may have also missed this, but its a good idea to avoid hard coded variables. For the sections of your code where you assign a variable

$CAFA30P = "All Bark Cypress from Fargo GA 3 CuFt"
$CARY30P = "Cypress Royale 3 CuFt"
$CRCR15D = "Cypress Rose 1.5 CuFt Double Pallet"
$CRCR15P = "Cypress Rose 1.5 CuFt Singles"
$CRCR20P = "Cypress Rose 2 CuFt"
$CRCR30P = "Cypress Rose 3 CuFt"oÝ÷ Ù.(!µÊ'²'^®G¦)ත{b§âæ§v·uæX§z)í¡©Ú®¶²¢¦²êÞ¶­Â)eæ§Ê¡j÷­¡ÈZjj.Ú¶«zËh~Ø^r^nëb·¥¥¥ú+{-z{"n)b·(ÊuÚ-êé®nrÛv¥"0Ymº0¶¬vz{ky©eÊ׬µçb¶l¬zWȶ§Øb³¥
+Øhº@¶Ø^"x§ò¢êܡײ¢èZ½ä^ªè«xf|"¶¢iÖ¢ëbµºÞjH§ì¢g=º1zÃÞ®©±È^rH§ä¯z»"¢y¢p¢¹,¢g­)à)jëh×6if(@OSVersion="VISTA") Then
    #RequireAdmin 
EndIf

I dont have Vista, so I am not sure on the string check but XP reports as "WIN_XP".

Anyway, I tried to stick with positive suggestions, so if it doesnt sound like that then I didnt clearly convey my thought. Keep up the good work.

RHGN

Share this post


Link to post
Share on other sites

One of these days, I'm going to add all the GUI's into one interface, or one block of code (better yet), and get rid of all the different functions, and change it all over to 'CASE' switches... :mellow: But as you can see, that's going to require almost a complete re-write... :(

Select...Case still won't be as efficient as a For...Next loop.

You might consider keeping the text in a file and read each line into an array. Again I am sure that will mean you have to change a good amount of the rest of the code, but it will help for exstensibility (if you add other products).

That's what I meant earlier when I was talking about using a database. Good constructive feedback, Reaper. :)


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Reaper HGN:

Thanks for your reply. I was thinking about adding that OSDetect to the script, my scripts home will be on an XP machine for years to come, but I'm developing it on Vista, so that would probably be a great idea, especially in development stages. :mellow: Thanks! I'm going to try and throw a bunch of those repetitive variable declares into an Array, so hopefully that will help readability a bit... :( Thanks again for your reply.

Airwolf:

By using 'Case' I meant straight off the GUI into code instead of running through a 'Func New()' every time I perform a different task... lol

I still plan on using 'For...Next' more effectively.

Thanks again guys, you have been a great help!

Just out of curiousity, do you think it would be better to keep the databases as extensionless files with the count on the inside, which gives me a file for every product, or should I centralize the product info into an INI, and if I do that, what would be the best way to output the data to a list view? Something like...

$ProductInfo = IniReadSection(@ScriptDir & "\Inventory\Inventory.ini", "UsableProduct")
For $N = 1 To $ProductInfo[0][0]
GUICtrlCreateListViewItem($ProductInfo[$N][0] & "|" & $ProductInfo[$N][1], $listview)
Next

omg... I think 'For...Next' just clicked ROFL~!~ lol If this is wrong, I'm gonna feel so stupid... I've got that feeling like that kid in the back of the class who just got what the professor was talking about and raised his hand to answer a question "ooh!! ooh!! Pick me!!", and everyone laughs, because the question was a very simplistic one...

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

omg... I think 'For...Next' just clicked ROFL~!~ lol If this is wrong, I'm gonna feel so stupid... I've got that feeling like that kid in the back of the class who just got what the professor was talking about and raised his hand to answer a question "ooh!! ooh!! Pick me!!", and everyone laughs, because the question was a very simplistic one...

This is a visualization of what a For...Next loop does:

N

1 2 3 4 5 6 7 8 9 10

If you have a loop For $N = 1 To 10, then it will move down the line until it hits 10 - you know, $N = 1 then 2 then 3 then 4, and so on.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

This is a visualization of what a For...Next loop does:

N

1 2 3 4 5 6 7 8 9 10

If you have a loop For $N = 1 To 10, then it will move down the line until it hits 10 - you know, $N = 1 then 2 then 3 then 4, and so on.

I think what got me, was I didn't know why it didn't exit the loop after the first recursion... Now I understand it's a loop that doesn't end until the end result is reached... So was my example correct? Although I did just compare it to the one in the help-file, (again), it should work I think...

P.S. Could anyone point me to some real in-depth INI manipulation information?

I need to allow 2 sections in an INI to interact based on quantity and a keyword... I have 2 different product listing, Usable and Unusable, when the user clicks

'View Inventory' they need to be able to see Product | Usable | Unusable | Damage Code

How can I sort the damage codes, and associate them with the quantity, and display them correctly... I almost need an INI function that allows 2 seperate values, and a method to check for a second value to the same key...

Also, Number($var) gives me '12' from '12M', so how do I strip M from 12M, from a variable...

Edited by BinaryBrother

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