Making the Simply Accounting Session Date default to today
In Simply Accounting, the Session Date is used for default dates of transactions. When one creates, for example, an invoice, the date is automatically assumed to be whatever the Session Date is. We've found no way to change the default of the Session Date from within Simply, but this can be accomplished by this handy script.
We are updating this post from two years ago. For some reason, the VBScript we wrote before quit working, due to something about the focus on the Session Date window. We couldn't make it work and decided it was less trouble to rewrite the script with AutoHotkey.
Here is the compiled version: SetSimplySessionDate.exe. Use it by creating a shortcut to SetSimplySessionDate.exe c:\path\to\your\datafile.sai. For any programmers here, we include the source code below:
; SetSimplySessionDate - Automatically set the session date when opening Simply Accounting. ; by Mango - http://www.toao.net/ ; No point in this running more than once. #SingleInstance force ; Find out if the user has specified a data file If (%0% == 0) { MsgBox % "You must specify the path and file name of a data file. Example: SetSimplySessionDate.exe ""c:\accounting\company.sai""" Exit } DataFile = %1% ; Run Simply Accounting Run, %DataFile%, , UseErrorLevel If (%ErrorLevel% == ERROR) { MsgBox % DataFile . " could not be loaded. Be sure that the path to the file is correct." Exit } ; Wait until it's active, or time out if it never becomes active WinWait, Simply Accounting - Session Date, , 60 If (ErrorLevel == 1) { Exit } WinActivate, Simply Accounting - Session Date ; Type in today's date. FormatTime, TimeString, , ShortDate ControlSetText, Edit1, %TimeString% Send {Enter} |
We include the old VBScript below, however we recommend using the new version instead.
' Script to automatically set the Simply Accounting session date ' By Mango - March 17, 2008 ' Find out if the user has specified a data file If WScript.Arguments.Count = 0 Then MsgBox "No data file specified!" wscript.quit End If ' Set datafile datafile = WScript.Arguments(0) ' Create the Wscript.Shell object. Set shell = CreateObject("Wscript.Shell") ' Run Simply Accounting shell.run """" & datafile & """" ' Wait until it's active, or time out if it never becomes active Do Until shell.AppActivate("Simply Accounting - Session Date") Wscript.Sleep 250 Tries = Tries + 1 If Tries > 200 Then wscript.quit Loop ' Type in today's date shell.SendKeys date & "{ENTER}" |