Sign in to follow this  
Followers 0
Dalex

Desktop Accountant

6 posts in this topic

#1 ·  Posted (edited)

I wrote this because my wife asked me to start keeping up with what I spent, I'm to lazy to keep a pen and paper with me at all times, so I keep the receipts and enter them in when I get back to my PC. It will create a text document on your desktop and write each new entry to the next line. (I send it to my number crunching wife once a week , and let it create a new one on my desktop)

I am posting it here because I am not a programmer (I just enjoy playing with Autoit) and I would like to see how you guys could improve my work, and maybe teach me better writing habits or an easy more effective way of doing something.

Thanks in advance for your constructive criticism.

uploaded the .au3 also

</P> <P>#include <GUIConstants.au3>
#include <File.au3></P> <P>Dim $tUser= @UserName
Dim $font   = "Comic Sans MS"
Dim $Amt
Dim $Where
Dim $What
Dim $Log = "AcctLog.txt"
Dim $Cash
Dim $Debit
Dim $Charge
Dim $Currency
Dim $msg</P> <P>Opt("GUIOnEventMode", 1); Change to OnEvent mode</P> <P>
Func CLOSEClicked ()
  Exit
EndFunc</P> <P> </P> <P>GUICreate("What I spent",215, 250,350,90); will create a dialog box that when displayed is centered
GUISetBkColor (0x5CACEE);sets the background color of the window
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetState (@SW_SHOW)   ; will display an empty dialog box</P> <P>;---------------------------------------------------------------------------------------------------------
GUICtrlCreateLabel("Amount spent",20,30,650,20)
GUICtrlSetFont(-1,12,17,4,$font)
$Amt = GUICtrlCreateInput("$", 30,60,50,20)</P> <P>;---------------------------------------------------------------------------------------------------------
GUICtrlCreateGroup("Currency",140,25,60,100 )
$Cash = GUICtrlCreateRadio("Cash", 140,45,50,20)
$Debit = GUICtrlCreateRadio("Debit", 140,65,50,20)
$Charge = GUICtrlCreateRadio("Charge", 140,85,55,20)
GUICtrlSetState($Debit, $Gui_CHECKED)
;---------------------------------------------------------------------------------------------------------
GUICtrlCreateLabel("Where",20,90,50,20)
GUICtrlSetFont(-1,12,17,4,$font)
$Where = GUICtrlCreateInput("", 30,110,100,20)
;---------------------------------------------------------------------------------------------------------
GUICtrlCreateLabel("What did you buy?", 20, 140, 50,20)
GUICtrlSetFont(-1,12,17,4,$font)
$What = GUICtrlCreateInput("", 30,160,100,20)
;---------------------------------------------------------------------------------------------------------</P> <P>;---------------------------------------------------------------------------------------------------------</P> <P>$Addto = GUICtrlCreateButton("Add to Log", 65, 220, 70)
GuiCtrlSetOnEvent($Addto, "WRITElog")</P> <P>GUISetState(@SW_SHOW)</P> <P> </P> <P>
;---------------------------------------------------------------------------------------------------------
Func WRITElog() 

;Read the radio boxes to see which one is checked  
If  GUICtrlRead ($Cash) = $Gui_CHECKED Then
  $RadioMSG = "Cash"
   
ElseIf GUICtrlRead ($Debit) = $Gui_CHECKED Then
  $RadioMSG = "Debit"

ElseIf GUICtrlRead ($Charge) = $Gui_CHECKED Then
  $RadioMSG = "Credit Card" 
EndIf</P> <P>
$rAmt = GUICtrlRead ($Amt)
$rWhere = GUICtrlRead ($Where)
$rWhat = GUICtrlRead ($What)
_FileWriteLog(@DesktopDir & "\" & $Log, $rAmt & "     " & $rWhere & "   " & $rWhat  & "              " & $RadioMSG) 
ControlSetText("What I spent", "", "Edit1" ,"$")
ControlSetText("What I spent", "", "Edit2" ,"")
ControlSetText("What I spent", "", "Edit3" ,"")

EndFunc
</P> <P> </P> <P>While 1
Sleep(1000); Mainline will just idle around until an event happens.
WEnd
</P> <P>

Desktop_Accountant.au3

Edited by Dalex

[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites



Groovy!! I Like It! I am using WinXp SP2 and 3.2.12.1 and beta 3.2.13.7 works great! Thanks for sharing...

Share this post


Link to post
Share on other sites

Thanks, and you are welcome!


[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites

Maybe it can read the log file and add all the spending and put that on the gui for a reminder of how much you have spent?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

Thats something that I had not thought of, may help me to spend less if I see how much I have already spent!


[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Share this post


Link to post
Share on other sites

That is a cool idea..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0