Jump to content
Sign in to follow this  

Recommended Posts

I'm working on a program with a colleague. He wants to create a function which takes 3 parameters and then loop through two arrays which I think we can do well enough. However, we want this to be attached to a GUI form we've built so when the user clicks a button, it will invoke the function which then takes the local variables as the parameters for the function and executes it.

I know that GUICtrlSetOnEvent can't take parameters, but is there a way to get around this and make this work?

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#include <IE.au3>
#include <InetConstants.au3>
#include <StringConstants.au3>
#include <FileConstants.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

Opt('GUIOnEventMode', 1)

GUICreate("JCSO NCIC Entry", 1500, 900)

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

Global $sFont = "Calibri"

;LICENSE VARIABLES
Global $FLmke
Global $FLori
Global $FLlic
Global $FLlis
Global $FLliy
Global $FLlit
Global $FLdot
Global $FLoca
Global $FLnic
Global $FLlki
Global $FLlka
Global $FLnoa
Global $FLmis
Global $FLdor
Global $FLofc
Global $FLdoe
Global $FLop1
Global $FLdo2
Global $FLop2
Global $FLdom
Global $FLop3
Global $FLdoc
Global $FLop4

;Menu Creation
Local $filemenu = GUICtrlCreateMenu("&File")
Local $helpmenu = GUICtrlCreateMenu("?")
Local $openItem = GUICtrlCreateMenuItem("&Open", $filemenu)
Local $saveItem = GUICtrlCreateMenuItem("&Save", $filemenu)
Local $infoItem = GUICtrlCreateMenuItem("Info", $helpmenu)
Local $exitItem = GUICtrlCreateMenuItem("E&xit", $filemenu)

;Tab Creation
GUICtrlCreateTab(0,0,1500,880)

;Create the License Plate Tab
GUICtrlCreateTabItem("License Plate")

;Create the form labels
GUICtrlCreateLabel("Message Key (MKE)", 20, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Originating Agency (ORI)", 20, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate No. (LIC)", 20, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate St. (LIS)", 20, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Expiration Year (LIY)", 20, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate Type (LIT)", 20, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Theft (DOT)", 20, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Case Number (OCA)", 20, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("NCIC Number (NIC)", 20, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Agency Id (LKI)", 20, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Case Number (LKA)", 20, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Notify Originating Agency (NOA)", 20, 480, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Miscellaneous Info (MIS)", 20, 520, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("ENTRY & SECOND PARTY CHECK", 550, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 6, $sFont, 5)
GUICtrlCreateLabel("", 500, 60, 200, 75)
GUICtrlCreateLabel("Date Received", 500, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Entry", 500, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Second Party Check", 500, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Modify Date", 500, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Clear, Cancel, or Locate Date", 500, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Officer/Agency", 500, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)

;Create the Input parameters
$FLmke = GUICtrlCreateCombo("", 225, 40, 200, 25)
$FLori = GUICtrlCreateInput("", 225, 80, 200, 25)
$FLlic = GUICtrlCreateInput("", 225, 120, 200, 25)
$FLlis = GUICtrlCreateCombo("", 225, 160, 200, 25)
$FLliy = GUICtrlCreateInput("", 225, 200, 200, 25)
$FLlit = GUICtrlCreateCombo("", 225, 240, 200, 25)
$FLdot = GUICtrlCreateDate("", 225, 280, 200, 25, $DTS_SHORTDATEFORMAT)
$FLoca = GUICtrlCreateInput("", 225, 320, 200, 25)
$FLnic = GUICtrlCreateInput("", 225, 360, 200, 25)
$FLlki = GUICtrlCreateInput("", 225, 400, 200, 25)
$FLlka = GUICtrlCreateInput("", 225, 440, 200, 25)
$FLnoa = GUICtrlCreateInput("", 225, 480, 200, 25)
$FLmis = GUICtrlCreateInput("", 225, 520, 200, 150)
$FLdor = GUICtrlCreateDate("", 675, 80, 200, 25, $DTS_SHORTDATEFORMAT)
$FLofc = GUICtrlCreateInput("", 675, 120, 200, 25)
$FLdoe = GUICtrlCreateDate("", 675, 160, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop1 = GUICtrlCreateInput("", 675, 200, 200, 25)
$FLdo2 = GUICtrlCreateDate("", 675, 240, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop2 = GUICtrlCreateInput("", 675, 280, 200, 25)
$FLdom = GUICtrlCreateDate("", 675, 320, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop3 = GUICtrlCreateInput("", 675, 360, 200, 25)
$FLdoc = GUICtrlCreateDate("", 675, 400, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop4 = GUICtrlCreateInput("", 675, 440, 200, 25)

Local $mke
Local $ori
Local $lic
Local $lis
Local $liy
Local $lit
Local $dot
Local $oca
Local $lki
Local $lka
Local $noa
Local $mis
Local $nic
Local $dor
Local $ofc
Local $doe
Local $op1
Local $do2
Local $op2
Local $dom
Local $op3
Local $doc
Local $op4

;Fill the Combo Box data
GUICtrlSetData($FLlis, $stateList)
GUICtrlSetData($FLlit, $ptList)
GUICtrlSetData($FLmke, $catList)

Local $oFileName = "StolenPlate"
Local $aInputVal[23] = [$mke, $ori, $lic, $lis, $liy, $lit, $dot, $oca, $lki, $lka, $noa, $mis, $nic, $dor, $ofc, $doe, $op1, $do2, $op2, $dom, $op3, $doc, $op4]
Local $aInputLoc[23] = ["C3","C5","C7","C9","C11","C13","C15","F3","F5","F7","F9","F11","F13","C21","F21","C22","F22","C23","F23","C24","F24","C25","F25"]

;Button 1
GUICtrlCreateButton("REJIS Entry", 1390, 760, 100, 30)
GUICtrlSetOnEvent(-1, 'PlateToRejis')

;Button 2
GUICtrlCreateButton("Print Preview", 1390, 800, 100, 30)
;GUICtrlSetOnEvent(-1, "TempForm")

Func TempForm($oFileName, $aInpulVal, $aInputLoc)
    ;****************************************************************************
    ; CREATE TEM FORM FROM CALLED DEFAULT FORM, RENAME, AND SAVE
    ;****************************************************************************
    Local $oTempFile = $oFileName&@ComputerName&@MDAY&@HOUR&@MIN&@SEC
    ;Create application object and open example workbook
    Local $oAppl = _Excel_Open(False)
    ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error creating the Excel application object.", & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\"&$oFileName&".xlsx")
    If @error Then
            MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error opening workbook '" & @ScriptDir & "\Forms\"&$oFileName&".xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_Close($oAppl)
            Exit
    EndIf
    ;****************************************************************************
    ; SAVE THE WORKBOOK (xlsx) TO ANOTHER DIRECTORY AND OPEN
    ;****************************************************************************
    Local $sWorkbook = @ScriptDir&"\archive\"&$oTempFile&".xlsx"
    _Excel_BookSaveAs($oWorkbook, $sWorkbook)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example 1", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_BookClose($oWorkBook)
    OpnWrt($oTempFile,$aInputVal,$aInputLoc)
EndFunc

Func OpnWrt($oFileName, $aInputVal, $aInputLoc)
    ; Create application object and open example workbook
    Local $oAppl = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\archive\"&$oFileName&".xlsx")
    If @error Then
            MsgBox($MB_SYSTEMMODAL, "Open Temp Doc", "Error opening workbook '" & @ScriptDir & "\Forms\"&$oFileName&".xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_Close($oAppl)
            Exit
    EndIf
    ;****************************************************************************
    ; WRITE DATA FROM GUI TO TEMP EXCEL DOC
    ;****************************************************************************
    For $a = 0 to UBound($aInputVal) -1
        _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aInputVal[$a], $aInputLoc[$a])
    Next
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 3", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_BookSave($oWorkBook)
    $oAppl = _Excel_Open()
EndFunc

Ok, that's a bit long, but it's the shell of the GUI function. The PlateToRejis function works fine so is not included. I've wondered if we even need to put the parameters in the function or just let them get called as they are 

Share this post


Link to post
Share on other sites

A working shell would be better  ... :D

I see two functions with three parameters:

TempForm($oFileName, $aInpulVal, $aInputLoc)
and 
OpnWrt($oFileName, $aInputVal, $aInputLoc)

You would need to tie one or both of them to the desired buttons and make sure the parameters being supplied have the appropriate scope so they can be read when called as part of the function. 

Edited by Jfish

Share this post


Link to post
Share on other sites

Sorry the whole thing is several hundred lines. So I was trying to edit for time purposes. I figured you wouldn't want to read some of the other stuff in there.  o:)

The second function is called in the first above it. (Not my code, I'm incorporating the other code and trying to finish off the wiring. 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#include <IE.au3>
#include <InetConstants.au3>
#include <StringConstants.au3>
#include <FileConstants.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Changes to OnEvent Mode
Opt('GUIOnEventMode', 1)
AutoItSetOption("WinTitleMatchMode",2)
AutoItSetOption("MouseCoordMode", 2)

GUICreate("JCSO NCIC Entry", 1500, 900)

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

GUISetIcon("icon.ico")
Global $sFont = "Calibri"

;LICENSE VARIABLES
Global $FLmke
Global $FLori
Global $FLlic
Global $FLlis
Global $FLliy
Global $FLlit
Global $FLdot
Global $FLoca
Global $FLnic
Global $FLlki
Global $FLlka
Global $FLnoa
Global $FLmis
Global $FLdor
Global $FLofc
Global $FLdoe
Global $FLop1
Global $FLdo2
Global $FLop2
Global $FLdom
Global $FLop3
Global $FLdoc
Global $FLop4

;MISSING PERSON VARIABLES
Global $FMmke
Global $FMori
Global $FMdlc
Global $FMoca
Global $FMmnp
Global $FMmpc
Global $FMnoa
Global $FMnam
Global $FMsex
Global $FMrac
Global $FMpob
Global $FMdob
Global $FMhgt
Global $FMwgt
Global $FMeye
Global $FMhai
Global $FMfbi
Global $FMskn
Global $FMsmt
Global $FMfpc
Global $FMmnu
Global $FMsoc
Global $FMdna
Global $FMdlo
Global $FMcmc
Global $FMctz
Global $FMbxr
Global $FMcrc
Global $FMvrx
Global $FMblt
Global $FMfpa
Global $FMoln
Global $FMols
Global $FMoly
Global $FMlic
Global $FMlis
Global $FMliy
Global $FMlit
Global $FMvin
Global $FMvyr
Global $FMvma
Global $FMvst
Global $FMvco
Global $FMlki
Global $FMlka
Global $FMjwl
Global $FMjwt
Global $FMmis
Global $FMnic
Global $FMdor
Global $FMdoe
Global $FMdo2
Global $FMdom
Global $FMdoc
Global $FMofc
Global $FMop1
Global $FMop2
Global $FMop3
Global $FMop4

;WARRANTS VARIABLES
Global $FWmke
Global $FWori
Global $FWnam
Global $FWsex
Global $FWrac
Global $FWpob
Global $FWdob
Global $FWhgt
Global $FWwgt
Global $FWeye
Global $FWhai
Global $FWfbi
Global $FWskn
Global $FWsmt
Global $FWfpc
Global $FWmnu
Global $FWsoc
Global $FWdna
Global $FWdno
Global $FWcmc
Global $FWctz
Global $FWetn
Global $FWoff
Global $FWdow
Global $FWoca
Global $FWwno
Global $FWcti
Global $FWnoa
Global $FWexl
Global $FWado
Global $FWlki
Global $FWlka
Global $FWoln
Global $FWols
Global $FWoly
Global $FWlic
Global $FWlis
Global $FWliy
Global $FWlit
Global $FWvin
Global $FWvyr
Global $FWvma
Global $FWvmo
Global $FWvst
Global $FWvco
Global $FWfnam
Global $FWfdob
Global $FWfsoc
Global $FWfmnu
Global $FWfoln
Global $FWfols
Global $FWfoly
Global $FWadd
Global $FWdda
Global $FWsnu
Global $FWsna
Global $FWcty
Global $FWsta
Global $FWzip
Global $FWcou
Global $FWmis
Global $FWocc
Global $FWnic
Global $FWdor
Global $FWdoe
Global $FWdo2
Global $FWdom
Global $FWdoc
Global $FWofc
Global $FWop1
Global $FWop2
Global $FWop3
Global $FWop4

; PROTECTION ORDER VARIABLES
Global $FPmke
Global $FPori
Global $FPnam
Global $FPsex
Global $FPrac
Global $FPpob
Global $FPdob
Global $FPhgt
Global $FPwgt
Global $FPeye
Global $FPhai
Global $FPfbi
Global $FPskn
Global $FPetn
Global $FPsmt
Global $FPfpc
Global $FPmnu
Global $FPsoc
Global $FPdna
Global $Fpdlo
Global $FPcmc
Global $FPctz
Global $FPpco
Global $FPbrd
Global $FPisd
Global $FPoca
Global $FPpno
Global $FPexp
Global $FPcti
Global $FPnoa
Global $FPoln
Global $FPols
Global $FPoly
Global $FPlic
Global $FPlis
Global $FPliy
Global $FPlit
Global $FPvin
Global $FPvyr
Global $FPvmo
Global $FPvst
Global $FPvco
Global $FPpnam
Global $FPpdob
Global $FPpsex
Global $FPprac
Global $FPpsoc
Global $FPmis
Global $FPnic
Global $FPdor
Global $FPdoe
Global $FPdo2
Global $FPdom
Global $FPdoc
Global $FPofc
Global $FPop1
Global $FPop2
Global $FPop3
Global $FPop4

; VEHICLE VARIABLES
Global $FVmke
Global $FVori
Global $FVdot
Global $FVoca
Global $FVoan
Global $FVopt
Global $FVlic
Global $FVlis
Global $FVliy
Global $FVlit
Global $FVvin
Global $FVvyr
Global $FVvma
Global $FVvmo
Global $FVvst
Global $FVvco
Global $FVnoa
Global $FVlki
Global $FVlka
Global $FVimn
Global $FVimt
Global $FVnic
Global $FVdor
Global $FVdoe
Global $FVdo2
Global $FVdom
Global $FVdoc
Global $FVofc
Global $FVop1
Global $FVop2
Global $FVop3
Global $FVop4

; DROP DOWN ARRAYS
Global $stateArray[66] = ["Alabama", "Alaska", "Alberta", "Arizona", "Arkansas", "British Columbia", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Gov't Plate", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Manitoba", "Maryland", "Massachusets", "Mexico", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Brunswick", "Newfoundland & Labrador", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northwest Territories", "Nova Scotia", "Ohio", "Oklahoma", "Ontario", "Oregon", "Pennsylvania", "Prince Edward Island", "Quebec", "Rhode Island", "Saskatchewan", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming", "Yukon Territory", "Other"]

Global $ptArray[29] = ["Passenger Car", "Personalized", "Ambulance", "Antique", "Apportioned", "Profession", "Legislator", "Justice", "Law Enforcement", "Handicapped", "Organization", "Motorcycle", "Truck-Tractor", "Trailer (all)", "Disabled Veteran", "Dealer (Auto)", "Doctor", "Amateur Radio", "College", "Temporary", "State Owned", "County", "Municipal", "Taxi", "U.S. Govt. Vehicle", "Truck", "Military Vehicle", "Manufacturer", "POW"]

Global $raceArray[7] = ["Alaskan Native", "American Indian", "Asian", "Black", "Pacific Islander", "Unkown", "White"]

Global $categoryArray[3] = ["Stolen/Missing Lic (All Issued) - 14", "Stolen/Missing Lic (Single Place) - 15", "Lost License/Tag - 16"]

Global $missingArray[8] = ["Catastrophe Victim", "Contact Witness Program", "Disappearance Involuntary", "Juvenile Other (13-17 yoa)", "Adult Other (specify in remarks)", "Physically or Mentally Disabled", "Physical Safety Endangered", "Walkaway"]

Global $sexArray[3] = ["Male", "Female", "Unknown"]

Global $eyeArray[10] = ["Black", "Blue", "Brown", "Green", "Grey", "Hazel", "Maroon", "Multi Color", "Pink", "Unknown"]

Global $hairArray[13] = ["Black", "Blond-Strawberry", "Blue", "Brown", "Green", "Grey", "Orange", "Pink", "Purple", "Red or Auburn", "Sandy", "White", "Unknown"]

Global $skinArray[13] = ["Albino", "Black", "Dark", "Dark Brown", "Fair", "Light", "Light Brown", "Medium Brown", "Medium", "Olive", "Ruddy", "Sallow", "Yellow"]

Global $extrArray[10] = ["Full Extradition - (1)", "Limited U.S Extradition - (2)", "Extradition - Surrounding States Only - (3)", "Extradition Limited Missouri Only - (4)", "Pending Extradition - (5)", "Intrastate (Entire State) - (S)", "Partial Intrastate - (P)", "Adjoining Counties - (C)", "Greater Metro Area(Local area) - (L)", "No Extradition - (N)"]

Global $cmcArray[16] = ["Alcoholic", "Allergies", "Armed and Dangerous", "Diabetic", "Epilepsy", "Escape Risk", "Explosives Expertise", "Heart Condition", "Hemophiliac", "Known to Abuse Drugs", "Martial Arts Expertise", "Medication Required", "Other - Enter Caution Description", "Sexually Violent Predator", "Suicidal", "Violent Tendencies"]

Global $rgbArray[34] = ["Amethyst (purple)", "Beige", "Black", "Blue", "Bronze", "Brown", "Burgundy (purple)", "Camouflage", "Chrome", "Copper", "Cream", "Dark Blue", "Gold", "Gray", "Green", "Dark Green", "Light Green", "Ivory", "Lavendar (purple)", "Light Blue", "Maroon", "Mauve (purple)", "Multicolored", "Orange", "Pink", "Purple", "Red", "Silver", "Tan", "Taupe (brown)", "Teal (green)", "Turquoise (blue)", "White", "Yellow"]

Global $vcatArray[8] = ["Failure To Return-41","Miscellaneous-45","Owner Forgot Where Parked-42","Repossessed-60","Stolen Vehicle-10","Wanted Felony-20","Wanted Misdemeanor-21","Wanted Ordinance-22"]

$stateList = ""
For $i = 0 To UBound($stateArray,1) -1
$stateList &= "|" & $stateArray[$i]
Next

$ptList = ""
For $j = 0 To UBound($ptArray,1) -1
$ptList &= "|" & $ptArray[$j]
Next

$raceList = ""
For $k = 0 to UBound($raceArray,1) -1
$raceList &= "|" & $raceArray[$k]
Next

$catList = ""
For $l = 0 to UBound($categoryArray,1) -1
$catList &= "|" & $categoryArray[$l]
Next

$missList = ""
For $m = 0 to UBound($missingArray,1) -1
$missList &= "|" & $missingArray[$m]
Next

$sexList = ""
For $n = 0 to UBound($sexArray,1) -1
$sexList &= "|" & $sexArray[$n]
Next

$eyeList = ""
For $o = 0 to UBound($eyeArray,1) -1
$eyeList &= "|" & $eyeArray[$o]
Next

$hairList = ""
For $p = 0 to UBound($hairArray, 1) -1
$hairList &= "|" & $hairArray[$p]
Next

$skinList = ""
For $q = 0 to UBound($skinArray, 1) -1
$skinList &= "|" & $skinArray[$q]
Next

$extrList = ""
For $r = 0 to UBound($extrArray, 1) -1
$extrList &= "|" & $extrArray[$r]
Next

$cmcList = ""
For $s = 0 to UBound($cmcArray, 1) -1
$cmcList &= "|" & $cmcArray[$s]
Next

$rgbList = ""
For $t = 0 to UBound($rgbArray, 1) -1
$rgbList &= "|" & $rgbArray[$t]
Next

$vcatList = ""
For $u = 0 to UBound($vcatArray, 1) -1
$vcatList &= "|" & $vcatArray[$u]
Next

;Menu Creation
Local $filemenu = GUICtrlCreateMenu("&File")
Local $helpmenu = GUICtrlCreateMenu("?")
Local $openItem = GUICtrlCreateMenuItem("&Open", $filemenu)
Local $saveItem = GUICtrlCreateMenuItem("&Save", $filemenu)
Local $infoItem = GUICtrlCreateMenuItem("Info", $helpmenu)
Local $exitItem = GUICtrlCreateMenuItem("E&xit", $filemenu)

;Tab Creation
GUICtrlCreateTab(0,0,1500,880)

;Create the License Plate Tab
GUICtrlCreateTabItem("License Plate")

;Create the form labels
GUICtrlCreateLabel("Message Key (MKE)", 20, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Originating Agency (ORI)", 20, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate No. (LIC)", 20, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate St. (LIS)", 20, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Expiration Year (LIY)", 20, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate Type (LIT)", 20, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Theft (DOT)", 20, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Case Number (OCA)", 20, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("NCIC Number (NIC)", 20, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Agency Id (LKI)", 20, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Case Number (LKA)", 20, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Notify Originating Agency (NOA)", 20, 480, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Miscellaneous Info (MIS)", 20, 520, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("ENTRY & SECOND PARTY CHECK", 550, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 6, $sFont, 5)
GUICtrlCreateLabel("", 500, 60, 200, 75)
GUICtrlCreateLabel("Date Received", 500, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Entry", 500, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Second Party Check", 500, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Modify Date", 500, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Clear, Cancel, or Locate Date", 500, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Officer/Agency", 500, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)

;Create the Input parameters
$FLmke = GUICtrlCreateCombo("", 225, 40, 200, 25)
$FLori = GUICtrlCreateInput("", 225, 80, 200, 25)
$FLlic = GUICtrlCreateInput("", 225, 120, 200, 25)
$FLlis = GUICtrlCreateCombo("", 225, 160, 200, 25)
$FLliy = GUICtrlCreateInput("", 225, 200, 200, 25)
$FLlit = GUICtrlCreateCombo("", 225, 240, 200, 25)
$FLdot = GUICtrlCreateDate("", 225, 280, 200, 25, $DTS_SHORTDATEFORMAT)
$FLoca = GUICtrlCreateInput("", 225, 320, 200, 25)
$FLnic = GUICtrlCreateInput("", 225, 360, 200, 25)
$FLlki = GUICtrlCreateInput("", 225, 400, 200, 25)
$FLlka = GUICtrlCreateInput("", 225, 440, 200, 25)
$FLnoa = GUICtrlCreateInput("", 225, 480, 200, 25)
$FLmis = GUICtrlCreateInput("", 225, 520, 200, 150)
$FLdor = GUICtrlCreateDate("", 675, 80, 200, 25, $DTS_SHORTDATEFORMAT)
$FLofc = GUICtrlCreateInput("", 675, 120, 200, 25)
$FLdoe = GUICtrlCreateDate("", 675, 160, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop1 = GUICtrlCreateInput("", 675, 200, 200, 25)
$FLdo2 = GUICtrlCreateDate("", 675, 240, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop2 = GUICtrlCreateInput("", 675, 280, 200, 25)
$FLdom = GUICtrlCreateDate("", 675, 320, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop3 = GUICtrlCreateInput("", 675, 360, 200, 25)
$FLdoc = GUICtrlCreateDate("", 675, 400, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop4 = GUICtrlCreateInput("", 675, 440, 200, 25)

Local $mke
Local $ori
Local $lic
Local $lis
Local $liy
Local $lit
Local $dot
Local $oca
Local $lki
Local $lka
Local $noa
Local $mis
Local $nic
Local $dor
Local $ofc
Local $doe
Local $op1
Local $do2
Local $op2
Local $dom
Local $op3
Local $doc
Local $op4

;Fill the Combo Box data
GUICtrlSetData($FLlis, $stateList)
GUICtrlSetData($FLlit, $ptList)
GUICtrlSetData($FLmke, $catList)

Local $oFileName = "StolenPlate"
Local $aInputVal[23] = [$mke, $ori, $lic, $lis, $liy, $lit, $dot, $oca, $lki, $lka, $noa, $mis, $nic, $dor, $ofc, $doe, $op1, $do2, $op2, $dom, $op3, $doc, $op4]
Local $aInputLoc[23] = ["C3","C5","C7","C9","C11","C13","C15","F3","F5","F7","F9","F11","F13","C21","F21","C22","F22","C23","F23","C24","F24","C25","F25"]

;Button 1
GUICtrlCreateButton("REJIS Entry", 1390, 760, 100, 30)
GUICtrlSetOnEvent(-1, 'PlateToRejis')

;Button 2
GUICtrlCreateButton("Print Preview", 1390, 800, 100, 30)
;GUICtrlSetOnEvent(-1, "TempForm")

Func TempForm($oFileName, $aInpulVal, $aInputLoc)
    ;****************************************************************************
    ; CREATE TEM FORM FROM CALLED DEFAULT FORM, RENAME, AND SAVE
    ;****************************************************************************
    Local $oTempFile = $oFileName&@ComputerName&@MDAY&@HOUR&@MIN&@SEC
    ;Create application object and open example workbook
    Local $oAppl = _Excel_Open(False)
    ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error creating the Excel application object.", & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\"&$oFileName&".xlsx")
    If @error Then
            MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error opening workbook '" & @ScriptDir & "\Forms\"&$oFileName&".xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_Close($oAppl)
            Exit
    EndIf
    ;****************************************************************************
    ; SAVE THE WORKBOOK (xlsx) TO ANOTHER DIRECTORY AND OPEN
    ;****************************************************************************
    Local $sWorkbook = @ScriptDir&"\archive\"&$oTempFile&".xlsx"
    _Excel_BookSaveAs($oWorkbook, $sWorkbook)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example 1", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_BookClose($oWorkBook)
    OpnWrt($oTempFile,$aInputVal,$aInputLoc)
EndFunc

Func OpnWrt($oFileName, $aInputVal, $aInputLoc)
    ; Create application object and open example workbook
    Local $oAppl = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\archive\"&$oFileName&".xlsx")
    If @error Then
            MsgBox($MB_SYSTEMMODAL, "Open Temp Doc", "Error opening workbook '" & @ScriptDir & "\Forms\"&$oFileName&".xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_Close($oAppl)
            Exit
    EndIf
    ;****************************************************************************
    ; WRITE DATA FROM GUI TO TEMP EXCEL DOC
    ;****************************************************************************
    For $a = 0 to UBound($aInputVal) -1
        _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aInputVal[$a], $aInputLoc[$a])
    Next
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 3", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_BookSave($oWorkBook)
    $oAppl = _Excel_Open()
EndFunc

Func PlateToRejis()
    Local $mke = GUICtrlRead($FLmke)
  Local $ori = GUICtrlRead($FLori)
  Local $lic = GUICtrlRead($FLlic)
  Local $lis = GUICtrlRead($FLlis)
  Local $liy = GUICtrlRead($FLliy)
  Local $lit = GUICtrlRead($FLlit)
  Local $dot = GUICtrlRead($FLdot)
  Local $oca = GUICtrlRead($FLoca)
  Local $nic = GUICtrlRead($FLnic)
  Local $lki = GUICtrlRead($FLlki)
  Local $lka = GUICtrlRead($FLlka)

  Local $noa = GUICtrlRead($FLnoa)
  Local $mis = GUICtrlRead($FLmis)
  Local $dor = GUICtrlRead($FLdor)
  Local $doe = GUICtrlRead($FLdoe)
  Local $op1 = GUICtrlRead($FLop1)
  Local $do2 = GUICtrlRead($FLdo2)
  Local $op2 = GUICtrlRead($FLop2)
  Local $dom = GUICtrlRead($FLdom)
  Local $op3 = GUICtrlRead($FLop3)
  Local $doc = GUICtrlRead($FLdoc)
  Local $op4 = GUICtrlRead($FLop4)
    If WinActivate("REJIS - HOME") = 0 Then
    MsgBox(0, "Error", "The REJIS Home Window is not open, please re-open it and re-submit the query")
    ;Exit
  EndIf
  WinActivate("REJIS - HOME")
  Local $oIE = _IEAttach("REJIS - HOME")
  Local $oIE_Frame = _IEFrameGetObjByName($oIE, "MENUFRAME")
  Local $oForm = _IEFormGetCollection($oIE_Frame, 0)
  Local $oSelect = _IEFormElementGetObjByName($oForm, "pages")
  _IEFormElementOptionSelect($oSelect, "Vehicle Enter Stolen License", 1, "byText")
  Sleep(2000)
  Local $oIE2 = _IEAttach("REJIS - Vehicle Enter Stolen License")
  Local $oIEFrame2 = _IEFrameGetObjByName($oIE2, "MAIN")
  Local $oIE_Frame2 = _IEFrameGetObjByName($oIEFrame2, "TOP")
  Local $oForm2 = _IEGetObjByName($oIE_Frame2, "inquiry")
  Local $oOri = _IEGetObjByName($oForm2, "ori")
  Local $oMke = _IEGetObjByName($oForm2, "category")
  Local $oLic = _IEGetObjByName($oForm2, "lic")
  Local $oLis = _IEGetObjByName($oForm2, "lic_state")
  Local $oLiy = _IEGetObjByName($oForm2, "lic_year")
  Local $oLit = _IEGetObjByName($oForm2, "veh_lic_type")
  Local $oDot1 = _IEGetObjByName($oForm2, "report_date_mm")
  Local $oDot2 = _IEGetObjByName($oForm2, "report_date_dd")
  Local $oDot3 = _IEGetObjByName($oForm2, "report_date_yy")
  Local $oComp1 = _IEGetObjByName($oForm2, "comp1")
  Local $oComp2 = _IEGetObjByName($oForm2, "comp2")
  Local $oMis = _IEGetObjByName($oForm2, "ncic_misc")
    Local $RptDate = StringSplit($dot,"/",0)
  _IEFormElementSetValue($oOri, $ori)
  _IEFormElementOptionSelect($oMke, $mke, 1, "byText")
  _IEFormElementSetValue($oLic, $lic)
  _IEFormElementOptionSelect($oLis, $lis, 1, "byText")
  _IEFormElementSetValue($oLiy, $liy)
  _IEFormElementOptionSelect($oLit, $lit, 1, "byText")
  _IEFormElementSetValue($oDot1, $RptDate[1])
  _IEFormElementSetValue($oDot2, $RptDate[2])
  _IEFormElementSetValue($oDot3, $RptDate[3])
  _IEFormElementSetValue($oComp1, StringLeft($oca, 2))
  _IEFormElementSetValue($oComp2, StringRight($oca, 6))
  _IEFormElementSetValue($oMis, $mis)
EndFunc

GUISetState(@SW_SHOW)

;OnEvent mode
While 1
  Sleep(500)
WEnd

Func GUIExit()
  Exit
EndFunc

That's the whole of it and where I'm running into the headache is Button 2 The print preview button. I get an error is I take out the comment in front of the GUICtrlSetOnEvent and I understand that, but it sounds like I should just take those parameters out of TempForm and just call it as is. (If I am understanding this correctly)

Share this post


Link to post
Share on other sites

I know your head must be spinning, there are things all over the place there lol.

Before I offer some constructive criticism on your setup, let me try to help with your main issue.

As you have noticed, you cannot pass parameters with an onevent method.

So you have to really just make the params you want global if they need to be accessed ( or static, but that's a different setup within a function ).

These three vars:

TempForm($oFileName, $aInpulVal, $aInputLoc) <--

Make those global and fill them where ever you normally would.

Then remove the params from that function so it's just:

TempForm()

----

To help you maintain your code, you should separate your work bits into separate include files, and try to keep everything as compartmentalized as possible.

If that code gets any bigger, and I am sure it will, it's going to be a mess to try and debug.

On that point, debugging I mean, put more debug code in there.

Personally, I'd rather have something fail with my own personal error codes that I can easily find and fix, than a hard crash in front of a client.

Good luck ;)

P.S.  Are you an attorney?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

This "might" be a quick fix to your issues.  I changed the name of that array, removed on event mode, and wired the buttons to a new switch at the bottom.  The print preview button does stuff now - but I don't have your data to test ...

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#include <IE.au3>
#include <InetConstants.au3>
#include <StringConstants.au3>
#include <FileConstants.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Changes to OnEvent Mode
;Opt('GUIOnEventMode', 1)
AutoItSetOption("WinTitleMatchMode",2)
AutoItSetOption("MouseCoordMode", 2)

GUICreate("JCSO NCIC Entry", 1500, 900)

GUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit')

GUISetIcon("icon.ico")
Global $sFont = "Calibri"

;LICENSE VARIABLES
Global $FLmke
Global $FLori
Global $FLlic
Global $FLlis
Global $FLliy
Global $FLlit
Global $FLdot
Global $FLoca
Global $FLnic
Global $FLlki
Global $FLlka
Global $FLnoa
Global $FLmis
Global $FLdor
Global $FLofc
Global $FLdoe
Global $FLop1
Global $FLdo2
Global $FLop2
Global $FLdom
Global $FLop3
Global $FLdoc
Global $FLop4

;MISSING PERSON VARIABLES
Global $FMmke
Global $FMori
Global $FMdlc
Global $FMoca
Global $FMmnp
Global $FMmpc
Global $FMnoa
Global $FMnam
Global $FMsex
Global $FMrac
Global $FMpob
Global $FMdob
Global $FMhgt
Global $FMwgt
Global $FMeye
Global $FMhai
Global $FMfbi
Global $FMskn
Global $FMsmt
Global $FMfpc
Global $FMmnu
Global $FMsoc
Global $FMdna
Global $FMdlo
Global $FMcmc
Global $FMctz
Global $FMbxr
Global $FMcrc
Global $FMvrx
Global $FMblt
Global $FMfpa
Global $FMoln
Global $FMols
Global $FMoly
Global $FMlic
Global $FMlis
Global $FMliy
Global $FMlit
Global $FMvin
Global $FMvyr
Global $FMvma
Global $FMvst
Global $FMvco
Global $FMlki
Global $FMlka
Global $FMjwl
Global $FMjwt
Global $FMmis
Global $FMnic
Global $FMdor
Global $FMdoe
Global $FMdo2
Global $FMdom
Global $FMdoc
Global $FMofc
Global $FMop1
Global $FMop2
Global $FMop3
Global $FMop4

;WARRANTS VARIABLES
Global $FWmke
Global $FWori
Global $FWnam
Global $FWsex
Global $FWrac
Global $FWpob
Global $FWdob
Global $FWhgt
Global $FWwgt
Global $FWeye
Global $FWhai
Global $FWfbi
Global $FWskn
Global $FWsmt
Global $FWfpc
Global $FWmnu
Global $FWsoc
Global $FWdna
Global $FWdno
Global $FWcmc
Global $FWctz
Global $FWetn
Global $FWoff
Global $FWdow
Global $FWoca
Global $FWwno
Global $FWcti
Global $FWnoa
Global $FWexl
Global $FWado
Global $FWlki
Global $FWlka
Global $FWoln
Global $FWols
Global $FWoly
Global $FWlic
Global $FWlis
Global $FWliy
Global $FWlit
Global $FWvin
Global $FWvyr
Global $FWvma
Global $FWvmo
Global $FWvst
Global $FWvco
Global $FWfnam
Global $FWfdob
Global $FWfsoc
Global $FWfmnu
Global $FWfoln
Global $FWfols
Global $FWfoly
Global $FWadd
Global $FWdda
Global $FWsnu
Global $FWsna
Global $FWcty
Global $FWsta
Global $FWzip
Global $FWcou
Global $FWmis
Global $FWocc
Global $FWnic
Global $FWdor
Global $FWdoe
Global $FWdo2
Global $FWdom
Global $FWdoc
Global $FWofc
Global $FWop1
Global $FWop2
Global $FWop3
Global $FWop4

; PROTECTION ORDER VARIABLES
Global $FPmke
Global $FPori
Global $FPnam
Global $FPsex
Global $FPrac
Global $FPpob
Global $FPdob
Global $FPhgt
Global $FPwgt
Global $FPeye
Global $FPhai
Global $FPfbi
Global $FPskn
Global $FPetn
Global $FPsmt
Global $FPfpc
Global $FPmnu
Global $FPsoc
Global $FPdna
Global $Fpdlo
Global $FPcmc
Global $FPctz
Global $FPpco
Global $FPbrd
Global $FPisd
Global $FPoca
Global $FPpno
Global $FPexp
Global $FPcti
Global $FPnoa
Global $FPoln
Global $FPols
Global $FPoly
Global $FPlic
Global $FPlis
Global $FPliy
Global $FPlit
Global $FPvin
Global $FPvyr
Global $FPvmo
Global $FPvst
Global $FPvco
Global $FPpnam
Global $FPpdob
Global $FPpsex
Global $FPprac
Global $FPpsoc
Global $FPmis
Global $FPnic
Global $FPdor
Global $FPdoe
Global $FPdo2
Global $FPdom
Global $FPdoc
Global $FPofc
Global $FPop1
Global $FPop2
Global $FPop3
Global $FPop4

; VEHICLE VARIABLES
Global $FVmke
Global $FVori
Global $FVdot
Global $FVoca
Global $FVoan
Global $FVopt
Global $FVlic
Global $FVlis
Global $FVliy
Global $FVlit
Global $FVvin
Global $FVvyr
Global $FVvma
Global $FVvmo
Global $FVvst
Global $FVvco
Global $FVnoa
Global $FVlki
Global $FVlka
Global $FVimn
Global $FVimt
Global $FVnic
Global $FVdor
Global $FVdoe
Global $FVdo2
Global $FVdom
Global $FVdoc
Global $FVofc
Global $FVop1
Global $FVop2
Global $FVop3
Global $FVop4

; DROP DOWN ARRAYS
Global $stateArray[66] = ["Alabama", "Alaska", "Alberta", "Arizona", "Arkansas", "British Columbia", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Gov't Plate", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Manitoba", "Maryland", "Massachusets", "Mexico", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Brunswick", "Newfoundland & Labrador", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northwest Territories", "Nova Scotia", "Ohio", "Oklahoma", "Ontario", "Oregon", "Pennsylvania", "Prince Edward Island", "Quebec", "Rhode Island", "Saskatchewan", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming", "Yukon Territory", "Other"]

Global $ptArray[29] = ["Passenger Car", "Personalized", "Ambulance", "Antique", "Apportioned", "Profession", "Legislator", "Justice", "Law Enforcement", "Handicapped", "Organization", "Motorcycle", "Truck-Tractor", "Trailer (all)", "Disabled Veteran", "Dealer (Auto)", "Doctor", "Amateur Radio", "College", "Temporary", "State Owned", "County", "Municipal", "Taxi", "U.S. Govt. Vehicle", "Truck", "Military Vehicle", "Manufacturer", "POW"]

Global $raceArray[7] = ["Alaskan Native", "American Indian", "Asian", "Black", "Pacific Islander", "Unkown", "White"]

Global $categoryArray[3] = ["Stolen/Missing Lic (All Issued) - 14", "Stolen/Missing Lic (Single Place) - 15", "Lost License/Tag - 16"]

Global $missingArray[8] = ["Catastrophe Victim", "Contact Witness Program", "Disappearance Involuntary", "Juvenile Other (13-17 yoa)", "Adult Other (specify in remarks)", "Physically or Mentally Disabled", "Physical Safety Endangered", "Walkaway"]

Global $sexArray[3] = ["Male", "Female", "Unknown"]

Global $eyeArray[10] = ["Black", "Blue", "Brown", "Green", "Grey", "Hazel", "Maroon", "Multi Color", "Pink", "Unknown"]

Global $hairArray[13] = ["Black", "Blond-Strawberry", "Blue", "Brown", "Green", "Grey", "Orange", "Pink", "Purple", "Red or Auburn", "Sandy", "White", "Unknown"]

Global $skinArray[13] = ["Albino", "Black", "Dark", "Dark Brown", "Fair", "Light", "Light Brown", "Medium Brown", "Medium", "Olive", "Ruddy", "Sallow", "Yellow"]

Global $extrArray[10] = ["Full Extradition - (1)", "Limited U.S Extradition - (2)", "Extradition - Surrounding States Only - (3)", "Extradition Limited Missouri Only - (4)", "Pending Extradition - (5)", "Intrastate (Entire State) - (S)", "Partial Intrastate - (P)", "Adjoining Counties - (C)", "Greater Metro Area(Local area) - (L)", "No Extradition - (N)"]

Global $cmcArray[16] = ["Alcoholic", "Allergies", "Armed and Dangerous", "Diabetic", "Epilepsy", "Escape Risk", "Explosives Expertise", "Heart Condition", "Hemophiliac", "Known to Abuse Drugs", "Martial Arts Expertise", "Medication Required", "Other - Enter Caution Description", "Sexually Violent Predator", "Suicidal", "Violent Tendencies"]

Global $rgbArray[34] = ["Amethyst (purple)", "Beige", "Black", "Blue", "Bronze", "Brown", "Burgundy (purple)", "Camouflage", "Chrome", "Copper", "Cream", "Dark Blue", "Gold", "Gray", "Green", "Dark Green", "Light Green", "Ivory", "Lavendar (purple)", "Light Blue", "Maroon", "Mauve (purple)", "Multicolored", "Orange", "Pink", "Purple", "Red", "Silver", "Tan", "Taupe (brown)", "Teal (green)", "Turquoise (blue)", "White", "Yellow"]

Global $vcatArray[8] = ["Failure To Return-41","Miscellaneous-45","Owner Forgot Where Parked-42","Repossessed-60","Stolen Vehicle-10","Wanted Felony-20","Wanted Misdemeanor-21","Wanted Ordinance-22"]

$stateList = ""
For $i = 0 To UBound($stateArray,1) -1
$stateList &= "|" & $stateArray[$i]
Next

$ptList = ""
For $j = 0 To UBound($ptArray,1) -1
$ptList &= "|" & $ptArray[$j]
Next

$raceList = ""
For $k = 0 to UBound($raceArray,1) -1
$raceList &= "|" & $raceArray[$k]
Next

$catList = ""
For $l = 0 to UBound($categoryArray,1) -1
$catList &= "|" & $categoryArray[$l]
Next

$missList = ""
For $m = 0 to UBound($missingArray,1) -1
$missList &= "|" & $missingArray[$m]
Next

$sexList = ""
For $n = 0 to UBound($sexArray,1) -1
$sexList &= "|" & $sexArray[$n]
Next

$eyeList = ""
For $o = 0 to UBound($eyeArray,1) -1
$eyeList &= "|" & $eyeArray[$o]
Next

$hairList = ""
For $p = 0 to UBound($hairArray, 1) -1
$hairList &= "|" & $hairArray[$p]
Next

$skinList = ""
For $q = 0 to UBound($skinArray, 1) -1
$skinList &= "|" & $skinArray[$q]
Next

$extrList = ""
For $r = 0 to UBound($extrArray, 1) -1
$extrList &= "|" & $extrArray[$r]
Next

$cmcList = ""
For $s = 0 to UBound($cmcArray, 1) -1
$cmcList &= "|" & $cmcArray[$s]
Next

$rgbList = ""
For $t = 0 to UBound($rgbArray, 1) -1
$rgbList &= "|" & $rgbArray[$t]
Next

$vcatList = ""
For $u = 0 to UBound($vcatArray, 1) -1
$vcatList &= "|" & $vcatArray[$u]
Next

;Menu Creation
Local $filemenu = GUICtrlCreateMenu("&File")
Local $helpmenu = GUICtrlCreateMenu("?")
Local $openItem = GUICtrlCreateMenuItem("&Open", $filemenu)
Local $saveItem = GUICtrlCreateMenuItem("&Save", $filemenu)
Local $infoItem = GUICtrlCreateMenuItem("Info", $helpmenu)
Local $exitItem = GUICtrlCreateMenuItem("E&xit", $filemenu)

;Tab Creation
GUICtrlCreateTab(0,0,1500,880)

;Create the License Plate Tab
GUICtrlCreateTabItem("License Plate")

;Create the form labels
GUICtrlCreateLabel("Message Key (MKE)", 20, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Originating Agency (ORI)", 20, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate No. (LIC)", 20, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate St. (LIS)", 20, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Expiration Year (LIY)", 20, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("License Plate Type (LIT)", 20, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Theft (DOT)", 20, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Case Number (OCA)", 20, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("NCIC Number (NIC)", 20, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Agency Id (LKI)", 20, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Linking Case Number (LKA)", 20, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Notify Originating Agency (NOA)", 20, 480, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Miscellaneous Info (MIS)", 20, 520, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("ENTRY & SECOND PARTY CHECK", 550, 40, 200, 75)
GUICtrlSetFont(-1, 10, 700, 6, $sFont, 5)
GUICtrlCreateLabel("", 500, 60, 200, 75)
GUICtrlCreateLabel("Date Received", 500, 80, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Entry", 500, 160, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Date of Second Party Check", 500, 240, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Modify Date", 500, 320, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Clear, Cancel, or Locate Date", 500, 400, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Officer/Agency", 500, 120, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 200, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 280, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 360, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)
GUICtrlCreateLabel("Operator", 500, 440, 200, 75)
GUICtrlSetFont(-1, 10, 700, 1, $sFont, 5)

;Create the Input parameters
$FLmke = GUICtrlCreateCombo("", 225, 40, 200, 25)
$FLori = GUICtrlCreateInput("", 225, 80, 200, 25)
$FLlic = GUICtrlCreateInput("", 225, 120, 200, 25)
$FLlis = GUICtrlCreateCombo("", 225, 160, 200, 25)
$FLliy = GUICtrlCreateInput("", 225, 200, 200, 25)
$FLlit = GUICtrlCreateCombo("", 225, 240, 200, 25)
$FLdot = GUICtrlCreateDate("", 225, 280, 200, 25, $DTS_SHORTDATEFORMAT)
$FLoca = GUICtrlCreateInput("", 225, 320, 200, 25)
$FLnic = GUICtrlCreateInput("", 225, 360, 200, 25)
$FLlki = GUICtrlCreateInput("", 225, 400, 200, 25)
$FLlka = GUICtrlCreateInput("", 225, 440, 200, 25)
$FLnoa = GUICtrlCreateInput("", 225, 480, 200, 25)
$FLmis = GUICtrlCreateInput("", 225, 520, 200, 150)
$FLdor = GUICtrlCreateDate("", 675, 80, 200, 25, $DTS_SHORTDATEFORMAT)
$FLofc = GUICtrlCreateInput("", 675, 120, 200, 25)
$FLdoe = GUICtrlCreateDate("", 675, 160, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop1 = GUICtrlCreateInput("", 675, 200, 200, 25)
$FLdo2 = GUICtrlCreateDate("", 675, 240, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop2 = GUICtrlCreateInput("", 675, 280, 200, 25)
$FLdom = GUICtrlCreateDate("", 675, 320, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop3 = GUICtrlCreateInput("", 675, 360, 200, 25)
$FLdoc = GUICtrlCreateDate("", 675, 400, 200, 25, $DTS_SHORTDATEFORMAT)
$FLop4 = GUICtrlCreateInput("", 675, 440, 200, 25)

Local $mke
Local $ori
Local $lic
Local $lis
Local $liy
Local $lit
Local $dot
Local $oca
Local $lki
Local $lka
Local $noa
Local $mis
Local $nic
Local $dor
Local $ofc
Local $doe
Local $op1
Local $do2
Local $op2
Local $dom
Local $op3
Local $doc
Local $op4

;Fill the Combo Box data
GUICtrlSetData($FLlis, $stateList)
GUICtrlSetData($FLlit, $ptList)
GUICtrlSetData($FLmke, $catList)

Local $oFileName = "StolenPlate"
Local $aInputVal[23] = [$mke, $ori, $lic, $lis, $liy, $lit, $dot, $oca, $lki, $lka, $noa, $mis, $nic, $dor, $ofc, $doe, $op1, $do2, $op2, $dom, $op3, $doc, $op4]
Local $aInputLoc[23] = ["C3","C5","C7","C9","C11","C13","C15","F3","F5","F7","F9","F11","F13","C21","F21","C22","F22","C23","F23","C24","F24","C25","F25"]

;Button 1
$b1=GUICtrlCreateButton("REJIS Entry", 1390, 760, 100, 30)
;GUICtrlSetOnEvent(-1, 'PlateToRejis')

;Button 2
$b2=GUICtrlCreateButton("Print Preview", 1390, 800, 100, 30)
;GUICtrlSetOnEvent($b2, "TempForm")

Func TempForm($oFileName, $aInpulVal, $aInputLoc)
    ;****************************************************************************
    ; CREATE TEM FORM FROM CALLED DEFAULT FORM, RENAME, AND SAVE
    ;****************************************************************************
    Local $oTempFile = $oFileName&@ComputerName&@MDAY&@HOUR&@MIN&@SEC
    ;Create application object and open example workbook
    Local $oAppl = _Excel_Open(False)
    ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error creating the Excel application object.", & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\"&$oFileName&".xlsx")
    If @error Then
            MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error opening workbook '" & @ScriptDir & "\Forms\"&$oFileName&".xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_Close($oAppl)
            Exit
    EndIf
    ;****************************************************************************
    ; SAVE THE WORKBOOK (xlsx) TO ANOTHER DIRECTORY AND OPEN
    ;****************************************************************************
    Local $sWorkbook = @ScriptDir&"\archive\"&$oTempFile&".xlsx"
    _Excel_BookSaveAs($oWorkbook, $sWorkbook)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example 1", "Error saving workbook to '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_BookClose($oWorkBook)
    OpnWrt($oTempFile,$aInputVal,$aInputLoc)
EndFunc

Func OpnWrt($oFileName, $aInputVal, $aInputLoc)
    ; Create application object and open example workbook
    Local $oAppl = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookSaveAs Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oAppl, @ScriptDir & "\archive\"&$oFileName&".xlsx")
    If @error Then
            MsgBox($MB_SYSTEMMODAL, "Open Temp Doc", "Error opening workbook '" & @ScriptDir & "\Forms\"&$oFileName&".xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_Close($oAppl)
            Exit
    EndIf
    ;****************************************************************************
    ; WRITE DATA FROM GUI TO TEMP EXCEL DOC
    ;****************************************************************************
    For $a = 0 to UBound($aInputVal) -1
        _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aInputVal[$a], $aInputLoc[$a])
    Next
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 3", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_BookSave($oWorkBook)
    $oAppl = _Excel_Open()
EndFunc

Func PlateToRejis()
    Local $mke = GUICtrlRead($FLmke)
  Local $ori = GUICtrlRead($FLori)
  Local $lic = GUICtrlRead($FLlic)
  Local $lis = GUICtrlRead($FLlis)
  Local $liy = GUICtrlRead($FLliy)
  Local $lit = GUICtrlRead($FLlit)
  Local $dot = GUICtrlRead($FLdot)
  Local $oca = GUICtrlRead($FLoca)
  Local $nic = GUICtrlRead($FLnic)
  Local $lki = GUICtrlRead($FLlki)
  Local $lka = GUICtrlRead($FLlka)

  Local $noa = GUICtrlRead($FLnoa)
  Local $mis = GUICtrlRead($FLmis)
  Local $dor = GUICtrlRead($FLdor)
  Local $doe = GUICtrlRead($FLdoe)
  Local $op1 = GUICtrlRead($FLop1)
  Local $do2 = GUICtrlRead($FLdo2)
  Local $op2 = GUICtrlRead($FLop2)
  Local $dom = GUICtrlRead($FLdom)
  Local $op3 = GUICtrlRead($FLop3)
  Local $doc = GUICtrlRead($FLdoc)
  Local $op4 = GUICtrlRead($FLop4)
    If WinActivate("REJIS - HOME") = 0 Then
    MsgBox(0, "Error", "The REJIS Home Window is not open, please re-open it and re-submit the query")
    ;Exit
  EndIf
  WinActivate("REJIS - HOME")
  Local $oIE = _IEAttach("REJIS - HOME")
  Local $oIE_Frame = _IEFrameGetObjByName($oIE, "MENUFRAME")
  Local $oForm = _IEFormGetCollection($oIE_Frame, 0)
  Local $oSelect = _IEFormElementGetObjByName($oForm, "pages")
  _IEFormElementOptionSelect($oSelect, "Vehicle Enter Stolen License", 1, "byText")
  Sleep(2000)
  Local $oIE2 = _IEAttach("REJIS - Vehicle Enter Stolen License")
  Local $oIEFrame2 = _IEFrameGetObjByName($oIE2, "MAIN")
  Local $oIE_Frame2 = _IEFrameGetObjByName($oIEFrame2, "TOP")
  Local $oForm2 = _IEGetObjByName($oIE_Frame2, "inquiry")
  Local $oOri = _IEGetObjByName($oForm2, "ori")
  Local $oMke = _IEGetObjByName($oForm2, "category")
  Local $oLic = _IEGetObjByName($oForm2, "lic")
  Local $oLis = _IEGetObjByName($oForm2, "lic_state")
  Local $oLiy = _IEGetObjByName($oForm2, "lic_year")
  Local $oLit = _IEGetObjByName($oForm2, "veh_lic_type")
  Local $oDot1 = _IEGetObjByName($oForm2, "report_date_mm")
  Local $oDot2 = _IEGetObjByName($oForm2, "report_date_dd")
  Local $oDot3 = _IEGetObjByName($oForm2, "report_date_yy")
  Local $oComp1 = _IEGetObjByName($oForm2, "comp1")
  Local $oComp2 = _IEGetObjByName($oForm2, "comp2")
  Local $oMis = _IEGetObjByName($oForm2, "ncic_misc")
    Local $RptDate = StringSplit($dot,"/",0)
  _IEFormElementSetValue($oOri, $ori)
  _IEFormElementOptionSelect($oMke, $mke, 1, "byText")
  _IEFormElementSetValue($oLic, $lic)
  _IEFormElementOptionSelect($oLis, $lis, 1, "byText")
  _IEFormElementSetValue($oLiy, $liy)
  _IEFormElementOptionSelect($oLit, $lit, 1, "byText")
  _IEFormElementSetValue($oDot1, $RptDate[1])
  _IEFormElementSetValue($oDot2, $RptDate[2])
  _IEFormElementSetValue($oDot3, $RptDate[3])
  _IEFormElementSetValue($oComp1, StringLeft($oca, 2))
  _IEFormElementSetValue($oComp2, StringRight($oca, 6))
  _IEFormElementSetValue($oMis, $mis)
EndFunc

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

    case $b1
        PlateToRejis()
    case $b2
         TempForm($oFileName, $aInputVal, $aInputLoc)

        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func GUIExit()
  Exit
EndFunc

Oh yeah, and @SmOke_N  and @czardas are right about the better approach being what they said.

Edited by Jfish

Share this post


Link to post
Share on other sites

Thank you all. SmOke_N Nope, Not a lawyer, work with a sheriff's office. However, I know where you're coming from with that. I should have thought about making those global. With the two arrays, those are going to change size in each place, so I'm thinking just set them as eg. Global $aInputVal[] and then add the correct parameter lists in the individual tabs. 

Jfish, I might end up going with that. Either way, I appreciate both of the ideas and I will incorporate them in this. 

Yes, it's going to be huge when it finishes out. However, down the road, I can see it modularized better. 

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  

  • Similar Content

    • By coronatuss
      Hello eveyone,
      I installed the latest version of Autoit (x86 - for greater compatibility) and SciTE.
      Every time I want to generate the GUI code designed in Koda, the program freezes (only Koda, not SciTE).
      Have you ever had this problem? Do you know how to fix it?
      Thanks!
    • By nacerbaaziz
      hello sirs, i've created a tool to the blind users, this tool helps the blind to listen to a audio effect when moving between the GUIs controls on they computers
      where this tool can get the class for the current focus control and play a sound from a folder
      i've added all the knowne classes, but i found some problems i hope any one can help me.
      this is the code that i created

      #include <WinAPISys.au3> Global $h_CurrentHWNDFocus = "", $h_CurrentControlHWNDFocus = "" AdlibRegister("WindowAudioFocus", 50) Func WindowAudioFocus()     Local $h_NewHWNDFocus = WinGetHandle("[active]", "")     Local $h_NewControlHWNDFocus = ControlGetFocus($h_NewHWNDFocus, "")     If ($h_NewHWNDFocus = $h_CurrentHWNDFocus) And ($h_NewControlHWNDFocus = $h_CurrentControlHWNDFocus) Then Return 0     AdlibUnRegister("WindowAudioFocus")     If Not ($h_NewHWNDFocus = $h_CurrentHWNDFocus) Then         SoundPlay(@ScriptDir & "\focus_Audio\WindowChanged.wav")     Else         Switch _WinAPI_GetClassName(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus))             Case "Button", "Start", "TrayButton", "TrayShowDesktopButtonWClass", "sbutton", "CirrussButton", "ODbcButton", "ThunderRTCommandButton", "ThunderSSOption", "ThunderSSCommand", "ThunderCommandButton", "ThunderRT6CommandButton", "ThunderRT5CommandButton", "TButton", "TBitBtn", "TAdvGlowButton", "ButtonWndClass", "afx:0:376:baa946", "_AOL_Button"                 If _IsCheckBox(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then                     SoundPlay(@ScriptDir & "\focus_Audio\checkBox.wav")                 ElseIf _IsRadio(ControlGetHandle($h_NewHWNDFocus, "", $h_NewControlHWNDFocus)) Then                     SoundPlay(@ScriptDir & "\focus_Audio\radio.wav")                 Else                     SoundPlay(@ScriptDir & "\focus_Audio\button.wav")                 EndIf             Case "ComboBox", "ComboBoxEx32", "MSOBALLOONREComboBox20W", "REComboBox20W", "ThunderComboBox", "ThunderDriveListBox", "ThunderRT6ComboBox", "TORComboEdit", "TCombobox", "TComboBoxEx", "TORComboBox", "TColorBox", "TNFComboBox", "Internet Explorer_TridentCmbobx", "ComboWndClass", "_AOL_ComboBox", "ThunderRT5ComboBox", "ComboLBox"                 SoundPlay(@ScriptDir & "\focus_Audio\list.wav")             Case "Edit", "SearchBox", "TChatRichEdit", "_WwN", "_WwO", "RichEdit20A", "RichEdit20WPT", "RICHEDIT60W", "OKttbx", "RichEditA", "ThunderTextBox", "ThunderRT6TextBox", "ThunderRT5TextBox", "TEdit", "TRichEdit", "TRichEditViewer", "TMemo", "TInplaceEditList", "TLabeledEdit", "TMaskEdit", "TDateTimePicker", "TRichEdit", "TCaptionMemo", "TAddictRichEdit", "TCaptionEdit", "RichTextWndClass", "TextWndClass", "PasswordWndClass", "TextAreaWndClass", "MSWorksDoc", "_AOL_Edit", "SysDateTimePick32"                 SoundPlay(@ScriptDir & "\focus_Audio\edit.wav")             Case "ListBox", "ComboLBox", "REListBox20W", "SUPERGRID", "OUTEXVLB", "WMSUIVLB", "SchdmapiVLB", "VLBClass", "ThunderDirListBox", "ThunderFileListBox", "ThunderListBox", "ThunderRT6ListBox", "ThunderRT5ListBox", "TListbox", "TValueListEditor", "TORCalendar", "TColorListBox", "TCheckListBox", "Internet Explorer_TridentLstBox", "ListBoxWndClass", "ListWndClass", "hh_kwd_vlist", "afx:8:376:0:946", "_AOL_ListBox", "_AOL_Tree", ""                 SoundPlay(@ScriptDir & "\focus_Audio\List.wav")             Case "SysListView32", "OpenListView", "wuDuiListView", "ListView20WndClass", "TcxGridSite", "TListView", "TSystemListView", "ListViewWndClass", ""                 SoundPlay(@ScriptDir & "\focus_Audio\ListView.wav")             Case "SysTreeView32", "SearchTreeList", "FeatureTree", "TreeView20WndClass", "TSystemTreeView", "TTreeView", ""                 SoundPlay(@ScriptDir & "\focus_Audio\TreeView.wav")             Case Else                 SoundPlay(@ScriptDir & "\focus_Audio\focus.wav")         EndSwitch     EndIf     $h_CurrentHWNDFocus = $h_NewHWNDFocus     $h_CurrentControlHWNDFocus = $h_NewControlHWNDFocus     AdlibRegister("WindowAudioFocus", 50)     Return 1 EndFunc   ;==>WindowAudioFocus Func _IsCheckBox($ctrl_hwnd)     $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)     Return BitAND($Style, $BS_CHECKBOX) = $BS_CHECKBOX EndFunc   ;==>_IsCheckBox Func _IsRadio($ctrl_hwnd)     $Style = _WinAPI_GetWindowLong($ctrl_hwnd, $GWL_STYLE)     Return BitAND($Style, $BS_AUTORADIOBUTTON) = $BS_AUTORADIOBUTTON EndFunc   ;==>_IsRadio
      what i need from you is :
      play a sound when a menu item focus, that sound named menu.wav
      play a sound named items.wav when the users move on list box items or list view or treeview items or a combobox items
      please if can any one help me i'll very happy
      thanks on advance
    • By nacerbaaziz
      hello sirs, please i created a tool witch get the focused control in a window and play a audio file linked with this controls
      e.g buttons, checkBoxes, radios, comboboxes, and others
      i know that their is a function that give us the control focus but it return the classNN
      i want to get the class name to use it with a switch and
      because their are more than class e.g button tbutton timagebutton tnewButton...
      please can any one help me to get the class name not the classnn
      thanks in advance
    • By CarlD
      Update: Download the latest version here.
      As my first stab at GUI scripting, I'm trying to write a simple graphical interface for Grep for Windows. I have a basic GUI, but I'm stuck on one point and nothing I've tried so far works. The sticking point is that while the Tab key works to move focus from one input control to the next, clicking the mouse on any but the first input does nothing. This seems like a basic feature of GUI functionality that should work out of the box (like Tab), but clearly I'm missing something. I tried (among many other things) Melba23's technique in the post below, but this doesn't do what I'm after -- getting the left click to set the insertion point for user input. Would greatly appreciate a pointer or two. 😉
      Here's my code so far:
      ; Grep for Windows -- GUI [CLD] #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Opt("WinTitleMatchMode", -2) #cs FileInstall("X:\nix\search1.ico", @TempDir & "\search1.ico") FileInstall("X:\nix\grep.exe", @TempDir & "\grep.exe") FileInstall("X:\nix\sed.exe", @TempDir & "\sed.exe") FileInstall("X:\nix\libiconv2.dll", @TempDir & "\libiconv2.dll") FileInstall("X:\nix\libintl3.dll", @TempDir & "\libintl3.dll") FileInstall("X:\nix\pcre3.dll", @TempDir & "\pcre3.dll") FileInstall("X:\nix\regex2.dll", @TempDir & "\regex2.dll") #ce ; $sDefFs = @ScriptDir & "\.txt" $sOut = "" $iX = 20 $iY = 20 $hgGGrep = GUICreate("Grep for Windows: Simple TeXT search", 600, 600) GUISetState(@SW_SHOW, $hgGGrep) ; Obtain value of control: GUICtrlRead() ; left, top, width, height ; $iX, $iY, $iX + n, $iY + m ; $hgIco = GUICtrlCreateIcon(@ScriptDir & "\search1.ico", $iX, $iY, 10) $hgGL0 = GUICtrlCreateLabel("Enter a string or regular expression" & @CRLF & "(space between words means ""OR"")", $iX + 50, $iY, 250, 30) $hgSch = GUICtrlCreateInput("", $iX + 50, $iY + 40, 325, 20, $GUI_SS_DEFAULT_INPUT, -1) $hgXyZ = GUICtrlCreateCheckbox("cAsE-sEnSiTiVe", $iX + 50, $iY + 65, -1, -1) $hgExe = GUICtrlCreateButton("Search", 400, $iY + 40, -1, -1) $hgFL1 = GUICtrlCreateLabel("Filespec", $iX + 50, $iY + 100, 250, 20) $hgFs1 = GUICtrlCreateInput("d:\path\*.txt", $iX + 110, $iY + 100, 250, 20, $GUI_SS_DEFAULT_INPUT, -1) $hgFL2 = GUICtrlCreateLabel("Filespec", $iX + 50, $iY + 120, 250, 20) $hgFs2 = GUICtrlCreateInput("", $iX + 110, $iY + 120, 250, 20, $GUI_SS_DEFAULT_INPUT, -1) $hgFL3 = GUICtrlCreateLabel("Filespec", $iX + 50, $iY + 140, 250, 20) $hgFs3 = GUICtrlCreateInput("", $iX + 110, $iY + 140, 250, 20, $GUI_SS_DEFAULT_INPUT,-1) $hgOut = GUICtrlCreateEdit($sOut, 25, 190, 550, 400, $ES_LEFT, -1) GUICtrlSetState($hgSch, $GUI_FOCUS) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ; #cs _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgSch)) _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgFs1)) _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgFs2)) _WinAPI_SetFocus(ControlGetHandle("Grep for Windows", "", $hgFs3)) #ce Thanks in advance.
    • By Elizabeth
      Buttons on GUI to perform different tasks. SETUP is a task that involves displaying another GUI, doing calculations, writing lines to 2 external files, displaying information on GUI labels.  The info from the displayed GUI (quantity made and job completed YES or NO) must be included on the written lines. I cannot get the script to run synchronously (waterfall execution 1st one ends before 2nd one starts.) That means lines written to the files do not contain the required data.  I have read through FORUM and thought by inserting a boolean value and changing TRUE FALSE that I could solve this issue. I would have to set/reset the boolean before every function call to make it work. I've tried using Sleep but that just slows everything down and makes main GUI look unresponsive
      Is there a trick or tip someone can provide that forces synchronous execution?
      I am using OPT GUIOnEventMode
      Thank you for any insight into this issue.
×
×
  • Create New...