Valuater Posted March 5, 2006 Posted March 5, 2006 (edited) made by a requestexpandcollapse popup#region --- GuiBuilder code Start --- #region --- GuiBuilder code Start --- ; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> #include <WindowsConstants.au3> #Include <File.au3> #Include <GuiListView.au3> Dim $File_Location = @ScriptDir & "\Address.ini" Dim $num = 0, $Input_[10], $data_[10] If Not FileExists($File_Location) Then Set_Ini() $main = GUICreate(" Postal Express by Valuater", 612, 412, -1, -1);, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Group_1 = GUICtrlCreateGroup("Customer Panel", 10, 10, 250, 390) $Group_2 = GUICtrlCreateGroup("Customer Information", 280, 10, 320, 390) $Group_3 = GUICtrlCreateGroup("Search", 20, 30, 230, 140) $Group_4 = GUICtrlCreateGroup("Controls", 20, 180, 230, 210) $Combo_3 = GUICtrlCreateCombo("Search by...", 80, 50, 100, 21) $Input_11 = GUICtrlCreateInput("Search Criteria", 45, 85, 180, 20) $Label_10 = GUICtrlCreateLabel("Customer #: " & $num, 440, 30, 120, 25) GUICtrlSetFont(-1, 9.5, 550) $Label_12 = GUICtrlCreateLabel("Name", 300, 40, 70, 20) $Input_[1] = GUICtrlCreateInput("", 300, 60, 280, 20) $Label_14 = GUICtrlCreateLabel("Address", 300, 90, 90, 20) $Label_15 = GUICtrlCreateLabel("Street Name", 380, 90, 140, 20) $Input_[2] = GUICtrlCreateInput("", 300, 110, 70, 20) $Input_[3] = GUICtrlCreateInput("", 380, 110, 200, 20) $Label_18 = GUICtrlCreateLabel("City", 300, 140, 50, 20) $Label_19 = GUICtrlCreateLabel("County/Providence", 430, 140, 120, 20) $Input_[4] = GUICtrlCreateInput("", 300, 160, 110, 20) $Input_[5] = GUICtrlCreateInput("", 430, 160, 150, 20) $Label_22 = GUICtrlCreateLabel("State", 300, 190, 70, 20) $Label_23 = GUICtrlCreateLabel("Zip + 4", 390, 190, 110, 20) $Input_[6] = GUICtrlCreateInput("", 300, 210, 80, 20) $Input_[7] = GUICtrlCreateInput("", 390, 210, 190, 20) $Edit_26 = GUICtrlCreateLabel("Notes", 300, 240, 80, 20) $Edit_26 = GUICtrlCreateEdit("", 300, 260, 280, 120) ; controls $Button_9 = GUICtrlCreateButton("Start Search", 45, 120, 180, 30) $Button_10 = GUICtrlCreateButton("Add Customer", 45, 210, 180, 30) $Button_11 = GUICtrlCreateButton("Update Customer", 45, 250, 180, 30) $Button_12 = GUICtrlCreateButton("View All Customers", 45, 290, 180, 30) $Button_13 = GUICtrlCreateButton("Close Postal Express", 45, 330, 180, 30) GUISetState() GUICtrlSetData($Combo_3, "Customer #|Name|Address|Street|City|County|Zip+4|Notes") $viewer = GUICreate(" Postal Express by Valuater", 602, 432, 5, 5,$WS_BORDER, -1, $main) ;$viewer = GUICreate("", 602, 402, 5, 5, BitOR($WS_CHILD, $WS_BORDER, $DS_SETFOREGROUND), -1, $main) $Listview = GUICtrlCreateListView("#|Name|Address|Street|City|County|State|Zip+4|Notes", 10, 10, 582, 352) $Closer = GUICtrlCreateButton("Close", 230, 365, 180, 30) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_13 ExitLoop Case $msg = $Button_9 Set_Customers() Case $msg = $Button_10 Add_Customer() Case $msg = $Button_11 Update_Customer() Case $msg = $Button_12 GUISetState(@SW_SHOW, $viewer) Get_List() Case $msg = $Closer _GUICtrlListView_DeleteAllItems($listview) GUISetState(@SW_HIDE, $viewer) GUISetState(@SW_SHOW, $main) ;;; EndSelect WEnd Exit #endregion --- GuiBuilder generated code End --- ; --------------------------- Functions ----------------- Func Set_Ini() FileWriteLine($File_Location, "[Address]") FileWriteLine($File_Location, "1=David Jones,12345,This way,East Covina,Conway,CA,95505-4321,BIG DOG!!!") FileWriteLine($File_Location, "2=Danny Smith,678,That way,North Covina,Conway,CA,95505-4321,Rear House") FileWriteLine($File_Location, "3=Debra Jones,910,Which way,West Covina,Conway,CA,95505-4321,Cookies and Milk") EndFunc ;==>Set_Ini Func Set_Customers() $num = 0 $temp_info = GUICtrlRead($Combo_3) If $temp_info = "Search by..." Or $temp_info = "" Then Return If $temp_info = "Name" Then $temp_search = 1 If $temp_info = "Address" Then $temp_search = 2 If $temp_info = "Street" Then $temp_search = 3 If $temp_info = "City" Then $temp_search = 4 If $temp_info = "County" Then $temp_search = 5 If $temp_info = "Zip+4" Then $temp_search = 7 If $temp_info = "Notes" Then $temp_search = 8 If $temp_info = "Customer #" Then $num = GUICtrlRead($Input_11) Get_CNumber($num) Return EndIf $temp_find = GUICtrlRead($Input_11) $length = _FileCountLines($File_Location) For $x = 1 To $length - 1 $temp_file = IniRead($File_Location, "Address", $x, "Not Found") If $temp_file = "Not Found" Then MsgBox(0, "", "No Files\Folders Found.") Return EndIf $temp_split = StringSplit($temp_file, ",") If StringInStr($temp_split[$temp_search], $temp_find) Then For $t = 1 To $temp_split[0] -1 GUICtrlSetData($Input_[$t], $temp_split[$t]) $num = $x Next GUICtrlSetData($Edit_26, $temp_split[8]) GUICtrlSetData($Label_10, "Customer #: " & $num) Return EndIf Next EndFunc ;==>Set_Customers Func Get_CNumber($x) $temp_file = IniRead($File_Location, "Address", $x, "Not Found") If $temp_file = "Not Found" Then MsgBox(0, "", "No Files\Folders Found.") Return EndIf $temp_split = StringSplit($temp_file, ",") For $t = 1 To $temp_split[0] - 1 GUICtrlSetData($Input_[$t], $temp_split[$t]) $num = $x Next GUICtrlSetData($Edit_26, $temp_split[8]) GUICtrlSetData($Label_10, "Customer #: " & $num) Return EndFunc ;==>Get_CNumber Func Get_List() $length = _FileCountLines($File_Location) For $x = 1 To $length - 1 $temp_file = IniRead($File_Location, "Address", $x, "Not Found") If $temp_file = "Not Found" Then Return $temp_split = StringSplit($temp_file, ",") GUICtrlCreateListViewItem( $x & "|" & $temp_split[1] & "|" & $temp_split[2] & "|" & $temp_split[3] & "|" & $temp_split[4] & "|" & $temp_split[5] & "|" & $temp_split[6] & "|" & $temp_split[7] & "|" & $temp_split[8] & "|" ,$listview) Next EndFunc Func Add_Customer() $length = _FileCountLines($File_Location) IniWrite($File_Location, "Address", $length, GUICtrlRead($Input_[1]) &","& GUICtrlRead($Input_[2])&","& GUICtrlRead($Input_[3])&","& GUICtrlRead($Input_[4])&","& GUICtrlRead($Input_[5])&","& GUICtrlRead($Input_[6])&","&GUICtrlRead($Input_[7])&","& GUICtrlRead($Edit_26)) GUICtrlSetData($Label_10, "Customer #: " & $length) EndFunc Func UpDate_Customer() $num = StringTrimLeft(GUICtrlRead($Label_10), 12) IniWrite($File_Location, "Address", $num, GUICtrlRead($Input_[1]) &","& GUICtrlRead($Input_[2])&","& GUICtrlRead($Input_[3])&","& GUICtrlRead($Input_[4])&","& GUICtrlRead($Input_[5])&","& GUICtrlRead($Input_[6])&","&GUICtrlRead($Input_[7])&","& GUICtrlRead($Edit_26)) EndFunc... Tested and Update to v3.2.12.0 may 20088) Edited May 25, 2008 by Valuater
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now