Jump to content

Recommended Posts

  • Moderators
Posted

Either you can do 1 of 2 things... You can go the include folder in AutoIt and open the Array.au3 folder, and remove the (Const << part or you can download Beta http://www.autoitscript.com/autoit3/files/beta/autoit/ and the problem is fixed in there. (When running beta scripts be sure to use Alt+F5 in SciTe).

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.

Posted

Wow, its works great, thanks! I think 1 more thing and its done. How do I make it so when you go to View all you can right click on someone and go to delete?

Posted (edited)

Wow, its works great, thanks! I think 1 more thing and its done. How do I make it so when you go to View all you can right click on someone and go to delete?

Welcome!!!

I did everything you asked for... ( with programs its always one-more thing )

try something and i will help...but

i think it is easier to put a button on the main GUI for deleting by the Customer#

8)

Edited by Valuater

NEWHeader1.png

Posted

Welcome!!!

I did everything you asked for... ( with programs its always one-more thing )

try something and i will help...but

i think it is easier to put a button on the main GUI for deleting by the Customer#

8)

PM'd With Offer! :o

Posted (edited)

1

delete the old ini file

2

the list view will sort/desort any colomn by clicking the header

3

Added remove customer

4

Added Change of Address

this is a simplified way to do it

SEE NEXT POST

8)

Edited by Valuater

NEWHeader1.png

Posted

Valuater, truely great! But, the flaw my dad noticed is that, these people will not have the internet on the route to do the coa. Hope there is something you can do.

Thanks,

Sparrow

  • Moderators
Posted

Sparrow, you've been a member for almost 2 months, have you tried to do anything yourself?

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.

Posted

Better than that

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>
#Include <File.au3>
#Include <GuiListView.au3>

Dim $PEver = "1.0.3"
Dim $File_Location = @ScriptDir & "\Address.ini"
Dim $num = 0, $Input_[10], $data_[10], $COAInput_[10]

$Sound_lnk = @TempDir & "\Sound_lnk.wav"
FileInstall("C:\XPClean-web\Settings\XPClean-pics\Sounds\Notify.wav", $Sound_lnk)
$Logo_jpg = @TempDir & "\USPS.jpg"
FileInstall("C:\Temp\my-eagle.jpg", $Logo_jpg)
    
SoundPlay ($Sound_lnk,0)

If Not FileExists($File_Location) Then Set_Ini()


$main = GUICreate("  Postal Express   by Valuater   v" & $PEver, 612, 412, -1, -1) 
;GUISetBkColor (0xC9DBEF)
;GUISetBkColor (0xE4E1DC) ; will change background color
$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, 220)

$Combo_3 = GUICtrlCreateCombo("Search by...", 80, 50, 100, 21)
$Input_11 = GUICtrlCreateInput("Search Criteria", 45, 85, 180, 20)
$Label_10 = GUICtrlCreateLabel("Customer #: " & $num, 450, 28, 120, 22, $SS_SUNKEN + $SS_CENTER)
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("Change Of Address", 460, 140, 120, 20)
$Input_[4] = GUICtrlCreateInput("", 300, 160, 110, 20)
$Input_[5] = GUICtrlCreateInput("", 430, 160, 80, 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_7 = GUICtrlCreateButton("Clear Form", 350, 28, 80, 24)
$Button_8 = GUICtrlCreateButton("COA Form", 515, 158, 80, 24)
$Button_9 = GUICtrlCreateButton("Start Search", 45, 120, 180, 30)
$Button_10 = GUICtrlCreateButton("Add Customer", 45, 280, 180, 30)
$Button_11 = GUICtrlCreateButton("Update Customer", 45, 240, 180, 30)
$Button_12 = GUICtrlCreateButton("View All Customers", 45, 200, 180, 30)
$Button_13 = GUICtrlCreateButton("Remove Customer", 45, 320, 180, 30)
$Button_14 = GUICtrlCreateButton("COA  On-Line", 45, 360, 180, 30)

GUISetState()

GUICtrlSetData($Combo_3, "Customer #|Name|COA|Address|Street|City|Zip+4|Notes")

$viewer = GUICreate("  Postal Express   by Valuater", 700, 500, 5, 5,$WS_BORDER, -1, $main)
GUISetBkColor (0xE4E1DC) 
$Listview = GUICtrlCreateListView("#|Name|COA|Address|Street|City|State|Zip+4|Notes", 10, 10, 680, 400, -1, BitOR($LVS_EX_REGIONAL, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
$Closer = GUICtrlCreateButton("Close", 460, 425, 180, 30)
$Btn_view = GUICtrlCreateButton("View / Edit", 260, 425, 180, 30)
$Btn_COA = GUICtrlCreateButton("View COA", 60, 425, 180, 30)
GUISetState(@SW_HIDE)

$COA = GuiCreate("  Postal Express   by Valuater", 392, 340, 205, 150,$WS_BORDER, -1, $main) 
GUISetBkColor (0xC9DBEF)
GUICtrlCreateGroup("COA Dates", 15, 5, 365, 95)
GUICtrlCreateGroup("New Address", 15, 110, 365, 190)
$COALabel_1 = GuiCtrlCreateLabel("Customer #: ", 240, 25, 120, 22, $SS_SUNKEN + $SS_CENTER)
GUICtrlSetFont(-1, 9.5, 550)
$COAInput_[1] = GuiCtrlCreateDate("", 100, 25, 100, 20)
$COAInput_[2] = GuiCtrlCreateDate("", 100, 60, 100, 20)
$COAInput_[3] = GUICtrlCreateCombo("", 240, 60, 120, 20)
GUICtrlSetData( -1, "Individual|Family|Business", "Individual")
$COALabel_4 = GuiCtrlCreateLabel("Address", 30, 135, 70, 20)
$COALabel_5 = GuiCtrlCreateLabel("Street Name", 150, 135, 110, 20)
$COAInput_[4] = GuiCtrlCreateInput("", 30, 155, 70, 20)
$COAInput_[5] = GuiCtrlCreateInput("", 150, 155, 220, 20)
$COALabel_8 = GuiCtrlCreateLabel("City", 30, 190, 80, 20)
$COALabel_9 = GuiCtrlCreateLabel("State", 140, 190, 80, 20)
$COALabel_10 = GuiCtrlCreateLabel("Zip+4", 240, 190, 70, 20)
$COAInput_[6] = GuiCtrlCreateInput("", 30, 210, 90, 20)
$COAInput_[7] = GuiCtrlCreateInput("", 140, 210, 80, 20)
$COAInput_[8] = GuiCtrlCreateInput("", 240, 210, 130, 20)
$COALabel_15 = GuiCtrlCreateLabel("Start Date", 30, 28, 50, 20)
$COALabel_17 = GuiCtrlCreateLabel("End Date", 30, 62, 70, 20)
; Buttons
$COAButton_14 = GuiCtrlCreateButton("Save", 30, 255, 100, 30)
$COAButton_15 = GuiCtrlCreateButton("Delete", 150, 255, 100, 30)
$COAButton_16 = GuiCtrlCreateButton("Close", 270, 255, 100, 30)

; Date set up
$DTM_SETFORMAT = 0x1005
$COAstyle = "MM/dd/yyyy"
GuiCtrlSendMsg($COAInput_[1], $DTM_SETFORMAT, 0, $COAstyle)
GuiCtrlSendMsg($COAInput_[2], $DTM_SETFORMAT, 0, $COAstyle)

GuiSetState(@SW_HIDE)
Dim $B_DESCENDING; [_GUICtrlListViewGetSubItemsCount ($listview) ]
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_7
            Clear_Customers()
        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 = $Button_13
            Remove_Customer()
        Case $msg = $Button_14
            CO_Address()
        Case $msg = $Closer
            Close_List()
        Case $msg = $Btn_view
            Local $s_indices =  _GUICtrlListViewGetSelectedIndices($listview)
            Get_CNumber($s_indices + 1)
            GUISetState(@SW_HIDE, $viewer)
            _GUICtrlListViewDeleteAllItems($listview)
            Close_COA()
            GUISetState(@SW_SHOW, $main)
            GUISetState(@SW_RESTORE, $main)
        Case $msg = $Btn_COA
            Local $s_indices =  _GUICtrlListViewGetSelectedIndices($listview)
            Get_CNumber($s_indices + 1)
            Show_COA()
        Case $msg = $listview
            GUICtrlSetState( $Btn_view, $GUI_DISABLE)
            GUICtrlSetState( $Btn_COA, $GUI_DISABLE)
            _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview))
    ; COA Controls
        Case $msg = $Button_8
            Show_COA()
        Case $msg = $COAButton_14
            Save_COA()
        Case $msg = $COAButton_15
            Delete_COA()
        Case $msg = $COAButton_16
            Close_COA()
            GUISetState(@SW_SHOW, $main)
            GUISetState(@SW_RESTORE, $main)
    EndSelect
WEnd
SoundPlay ($Sound_lnk,1)
Exit

; --------------------------- Functions -----------------

Func Set_Ini()
    FileWriteLine($File_Location, "[Address]")
    FileWriteLine($File_Location, "1=David Jones,12345,This way,East Covina,None,CA,95505-4321,BIG DOG!!!")
    FileWriteLine($File_Location, "2=Danny Smith,678,That way,North Covina,None,CA,95505-4321,Rear House")
    FileWriteLine($File_Location, "3=Debra Jones,910,Which way,West Covina,None,CA,95505-4321,Cookies and Milk")
EndFunc  ;==>Set_Ini

Func Set_Customers()
    $num = 0
    $temp_info = GUICtrlRead($Combo_3)
    If $temp_info = "Name" Then 
        $temp_search = 1
    ElseIf $temp_info = "Address" Then 
        $temp_search = 2
    ElseIf $temp_info = "Street" Then 
        $temp_search = 3
    ElseIf $temp_info = "City" Then 
        $temp_search = 4
    ElseIf $temp_info = "County" Then 
        $temp_search = 5
    ElseIf $temp_info = "Zip+4" Then 
        $temp_search = 7
    ElseIf $temp_info = "Notes" Then 
        $temp_search = 8
    ElseIf $temp_info = "Customer #" Then
        $num = GUICtrlRead($Input_11)
        Get_CNumber($num)
        Return
    Else
        MsgBox(262208, "Sorry...", "Please Select a Search by...   ", 4)
        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(262208, "Sorry...", "No Files\Folders Found....   ", 4)
            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(262208, "Sorry...", "No Customer Found/Selected...   ", 4)
        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[5] & "|" & $temp_split[2] & "|" & $temp_split[3] & "|" & $temp_split[4] & "|" & $temp_split[6] & "|" & $temp_split[7] & "|" & $temp_split[8] ,$listview)
    Next
EndFunc

Func Close_List()
    GUICtrlSetState( $Btn_view, $GUI_ENABLE)
    GUICtrlSetState( $Btn_COA, $GUI_ENABLE)
    _GUICtrlListViewDeleteAllItems($listview)
    GUISetState(@SW_HIDE, $viewer)
    GUISetState(@SW_SHOW, $main)
    GUISetState(@SW_RESTORE, $main)
EndFunc

Func Clear_Customers()
    If GUICtrlRead($Input_[1]) = "" then Return
    for $x = 1 to 7
        GUICtrlSetData($Input_[$x], "")
    Next
    GUICtrlSetData($Edit_26, "")
    Clear_List()
    GUICtrlSetData($Label_10, "Customer #: 0")
    GUISetState( @SW_HIDE, $COA )
    Close_List()
EndFunc

Func Add_Customer()
    If GUICtrlRead($Input_[1]) = "" then Return
    $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)
    Clear_List()
    MsgBox(262208, "Great...", "Customer Added...   ", 4)
EndFunc

Func UpDate_Customer()
    If GUICtrlRead($Input_[1]) = "" then Return
    $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))
    Clear_List()
    MsgBox(262208, "Great...", "Customer Updated...   ", 4)
EndFunc

Func Remove_Customer()
    If GUICtrlRead($Input_[1]) = "" then Return
    $num = StringTrimLeft(GUICtrlRead($Label_10), 12)
    IniWrite($File_Location, "Address", $num, ",,,,,,,")
    FileDelete(@ScriptDir & "\COA_" & $num &".dat")
    for $x = 1 to 7
        GUICtrlSetData($Input_[$x], "")
    Next
    GUICtrlSetData($Edit_26, "")
    Clear_List()
    GUICtrlSetData($Label_10, "Customer #: 0")
    MsgBox(262208, "Great...", "Customer Removed...   ", 4)
EndFunc

Func Clear_List()
    FileDelete(@ScriptDir & "\Address.bak")
    FileDelete(@TempDir & "\new.ini")
    FileCopy($File_Location, @ScriptDir & "\Address.bak", 1)
    FileWriteLine(@TempDir & "\new.ini", "[Address]")
    $t = 0
    $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, ",")
        If $temp_split[1] = "" Then ContinueLoop
        $t = $t + 1
        IniWrite(@TempDir & "\new.ini", "Address", $t, $temp_split[1] & "," & $temp_split[2] & "," & $temp_split[3] & "," & $temp_split[4] & "," & $temp_split[5] & "," & $temp_split[6] & "," & $temp_split[7] & "," & $temp_split[8])
    Next
    FileCopy(@TempDir & "\new.ini", $File_Location, 1)
EndFunc

Func CO_Address()
    $web_loc = "https://moversguide.usps.com/mgservice/Home"
    Run(@ComSpec & " /c Start " & $web_loc, "", @SW_HIDE)
EndFunc
    
Func Show_COA()
    If GUICtrlRead($Input_[1]) = "" then Return
    $num = StringTrimLeft(GUICtrlRead($Label_10), 12)
    If $num = 0 Or $num = "" then Return
    GUICtrlSetData($COALabel_1, "Customer #: " & $num)
    GUISetState( @SW_SHOW, $COA )
    For $x = 4 to 8
        GUICtrlSetData( $COAInput_[$x], "" )
    Next
    If FileExists(@ScriptDir & "\COA_" & $num &".dat") Then
        $temp_split = StringSplit(FileReadLine(@ScriptDir & "\COA_" & $num &".dat", 1), ",")
        For $x = 1 to 8
            GUICtrlSetData( $COAInput_[$x], $temp_split[$x])
        Next
    EndIf
EndFunc

Func Save_COA()
    If GUICtrlRead($COAInput_[4]) = "" then Return
    $num = StringTrimLeft(GUICtrlRead($Label_10), 12)
    If $num = 0 Or $num = "" then Return
    $temp_info = ""
    For $x = 1 to 7
        $temp_info = $temp_info & GUICtrlRead($COAInput_[$x]) & ","
    Next
    $temp_info = $temp_info & GUICtrlRead($COAInput_[$x])
    FileDelete(@ScriptDir & "\COA_" & $num &".dat")
    FileWriteLine(@ScriptDir & "\COA_" & $num &".dat", $temp_info)
    GUICtrlSetData( $Input_[5], GUICtrlRead($COAInput_[2]))
    GUISetState( @SW_HIDE, $COA )
    Close_List()
    UpDate_Customer()
EndFunc 

Func Delete_COA()
    If GUICtrlRead($COAInput_[4]) = "" then Return
    $num = StringTrimLeft(GUICtrlRead($Label_10), 12)
    If $num = 0 Or $num = "" then Return
    FileDelete(@ScriptDir & "\COA_" & $num &".dat")
    For $x = 4 to 8
        GUICtrlSetData( $COAInput_[$x], "" )
    Next
    GUICtrlSetData( $Input_[5], "None" )
    GUISetState( @SW_HIDE, $COA )
    Close_List()
    UpDate_Customer()
EndFunc
    
Func Close_COA()
    GUISetState( @SW_HIDE, $COA )
EndFunc

8)

NEWHeader1.png

Posted

i have a couple of problems that i am working on... thats why its not finished... customizing too... looks good

but, honestly ... i dont think he can by the way it was designed...

maybe though... i have to give it some thought

8)

NEWHeader1.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...