DangerousDan Posted October 2, 2008 Share Posted October 2, 2008 Hello. My GF started a new job recently, and to make things easier on her since travel is required I decided I'd make a little expense tracker for her with my limited experience in AutoIt(read total n00b) and even less knowledge of any other language (read couldn't find water in the ocean) I need the help below, but what does everyone think of it? opinions and help are both welcome. This is what I have so far. The intent is to take the comma delimited text file this program creates from simple user inputs and import it into Excel, then format it into monthly reports with pivot tables. Everything works well so far, at least from the testing I've done. using option V to view entries is crap as far as user interface is concerned, anyone have any suggestions? how do I get an array to display with numbers beside it in an inputbox? I'm calling (for those of you who don't want to scroll through lines of code to find out my issue) splashtexton to display a message to the user, then calling _arraydisplay, then an inputbox while changing splashtext in order to delete an entry from the array. I have absolutely no idea how to mess with the gui portion of AutoIt, which is what I assume is one potential solution, and really didn't want to yet. I don't have the time or the energy(I learned most of what I know using AutoIt to help me at work) to get into it either:( expandcollapse popup#cs ---------------------------------------------------------------------------- Expense Tracker Author: Me Script Function: Daily Expense Tracker for quick user entry of expenses ready to format into monthly reports using Excel's Pivot Tables. #ce ---------------------------------------------------------------------------- ; include #include<array.au3> #include<file.au3> #include<date.au3> ;variables Global $selection = "" Global $mileagelineentry = "" Global $lineentry = "" Global $ETLOGFILEARRAY[1] = [""];array ;lookup array Global $codelookup = StringSplit("Gas,Regular Maintenance,Lunch, Dinner, Entertainment,Miscellaneous,Tools,Office Supplies,Miles", ",") ;date month year $tDate = _Date_Time_GetSystemTime() $date = _Date_Time_SystemTimeToDateStr($tDate) $monthcount = StringInStr($date, "/") $month = StringLeft($date, $monthcount - 1) $yearcount = StringInStr($date, "/", "", -1) $year = StringRight($date, $yearcount - 2) Global $counter = 1; for write to array ;main While 1 _Welcome() WEnd ;end main ;functions Func _Miles() $selection = "" $date = InputBox("Date", "Enter the date in the format MM/DD/YY" & @CR & "For example, September Sixteenth 2008 should be 9/16/08 or 09/16/08.") $Miles = InputBox("Mileage", "How many miles did you drive for business today?" & @CRLF & "If you see this box again, it's because you didn't enter a number.") If @error Then _Welcome() EndIf If ($Miles * .585) <> 0 Then $mileagelineentry = $date & "," & $Miles & ",9," & Round(($Miles * .585), 2) & ",Mileage Allowance" Return $mileagelineentry Else _Miles() EndIf EndFunc ;==>_Miles Func _viewentries() $selection = "" SplashTextOn("Today's Entries", "Decide what entry you want to remove, remember the number beside that entry, then close the window.", 500, 40, 500, 100, 5) _ArrayDisplay($ETLOGFILEARRAY, "Today's Entries") SplashTextOn("Today's Entries", "Now type the number in the box below for the entry you want to remove.", 500, 40, 500, 100, 5) $removeline = InputBox("", "Type line number to delete entry, type all and click OK to remove all entries, or click cancel to go back to the main menu.") If @error Then SplashOff() $removeline="" _Welcome() ElseIf $removeline = "all" Then $ETLOGFILEARRAY = "" $removeline="" Elseif $removeline="" Then _welcome() Elseif $removeline > ubound($ETLOGFILEARRAY) Or $removeline < 1 Then msgbox(64,"Error","That entry is not on the list.") $removeline="" _viewentries() Else _ArrayDelete($ETLOGFILEARRAY, $removeline) $removeline = "" _viewentries() EndIf Return EndFunc ;==>_viewentries Func _exitET() if $ETLOGFILEARRAY[0]<>"" Then $logfile = FileOpen("c:\program files\Expense Tracker\" & $month & $year & "ETlog.txt", 9) _FileWriteFromArray($logfile, $ETLOGFILEARRAY) FileClose($logfile) else MsgBox(64,"No Data","There was no data to save.",1.5) EndIf EndFunc ;==>_exitET Func _menuitem($codenumber, $codename) $selection = "" $date = InputBox("Date", "Enter the date in the format MM/DD/YY" & @CR & "For example, September Sixteenth 2008 should be 9/16/08 or 09/16/08.") If @error Then _Welcome() Else $menuboxamount = InputBox($codename, "How much did you spend on " & $codename & " today?" & @CRLF & "If you see this box again, it's because you didn't enter a number." & @CR & "**Please keep separete records for your tax filings.") If @error Then _Welcome() Else If ($menuboxamount * 1 <> 0) Then $lineentry = $date & ",0," & $codenumber & "," & $menuboxamount & "," & $codename Return $lineentry Else _menuitem($codenumber, $codename) EndIf EndIf EndIf EndFunc ;==>_menuitem Func _Welcome() while not @error $selection = "" $selection = InputBox("Welcome to your Expense Tracker", "Hello Erin! Please make a selection." & @CR & "1 - Gas" & @CR & "2 - Regular Maintenance" & @CR & "3 - Lunch" & @CR & "4 - Dinner" & @CR & "5 - Entertainment" & @CR & "6 - Miscellaneous" & @CR & "7 - Tools" & @CR & "8 - Office Supplies" & @CR & "9 - Miles" & @CR & "V - View or remove today's entries" & @CR & "X - To Save and Exit" & @CR & @CR & @CR & "Click cancel or press escape to close without saving", "", "", 300, 300) if @error then $exitkey=MsgBox(52, "DATA NOT SAVED", "Are you sure you would like to exit without saving?") If $exitkey = 7 Then $exitkey="" _Welcome() Else Exit EndIf EndIf If $selection = 9 Then _Miles() If $mileagelineentry <> "" Then _ArrayInsert($ETLOGFILEARRAY, $counter, $mileagelineentry) $counter = $counter + 1 Else EndIf ElseIf $selection = "V" Then if $ETLOGFILEARRAY[0]<>"" then _viewentries() Else MsgBox(64,"Error","There are no entries to view, please make another selection.",1.5) _welcome() EndIf Elseif $selection = "X" Then _exitET() Exit ElseIf ($selection>0) and ($selection<10) Then _menuitem($selection, $codelookup[$selection]) If $lineentry <> "" Then _ArrayInsert($ETLOGFILEARRAY, $counter, $lineentry) $counter = $counter + 1 Else EndIf Else MsgBox(64,"Error","That selection is invalid, please make another.",1) EndIf WEnd EndFunc ;==>_Welcome Link to comment Share on other sites More sharing options...
DangerousDan Posted October 3, 2008 Author Share Posted October 3, 2008 69 views and NO replies??? come on, at least one person has to have a suggestion or was just plain curious to see what I made:(... Link to comment Share on other sites More sharing options...
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