^t::
{
Gui, Margin, 0, 0
Gui, Add, MonthCal , xm+0 ym+0 w185 h160 Border vMyCalendar gOnClick ,
Gui, Add, Text , xm+185 ym+5 w70 h20 Right 0x200 , Reference #:
Gui, Add, Edit , xm+260 ym+5 w50 h20 vRefNo gOnClick ,
Gui
, Add
, Text
, xm
+315 ym
+5 w65 h20 Right 0x200
Number , Sequence #:
Gui, Add, Edit , xm+385 ym+5 w20 h20 vSeq gOnClick ,
Gui
, Add
, Text
, xm
+190 ym
+30 w200 h20 0x200
, Document Orgination
And Ownership:
Gui, Add, DropDownList, xm+190 ym+50 w250 h150 vOwnership gOnClick , Vendor||Company|Client|Other
Gui, Add, Text , xm+190 ym+75 w200 h20 0x200 , Document Type:
Gui, Add, DropDownList, xm+190 ym+95 w250 h150 vDocumentType gOnClick , Invoice||Packing Slip|Purchase Order|Work Order|Check|Proofing Document|Film|Drop Ship Document
Gui, Add, Text , xm+190 ym+120 w200 h20 0x200 , Initial Routing Direction:
Gui
, Add
, DropDownList
, xm
+190 ym
+140 w250 h150 vDirection gOnClick
, Sent Out||Returned
To Company|File Only
Gui, Add, Button , xm+370 ym+165 w70 h20 gClipboard, Clipboard
Gui, Add, StatusBar
SB_SetText( "Ready.", 1 )
Gui, Show, AutoSize, Filename Standardiser
}
OnClick:
{
Gui, Submit, NoHide ; Get current variable values.
; Handle "Document Orgination And Ownership" DDL.
If ( Ownership
= "Vendor" ) {
myAbbr1 := "V"
}
Else If ( Ownership
= "Company" ) {
myAbbr1 := "P"
}
Else If ( Ownership
= "Client" ) {
myAbbr1 := "C"
}
Else If ( Ownership
= "Other" ) {
myAbbr1 := "O"
}
; Handle "Document Type" DDL.
If ( DocumentType
= "Invoice" ) {
myAbbr2 := "IN"
}
Else If ( DocumentType
= "Packing Slip" ) {
myAbbr2 := "PS"
}
Else If ( DocumentType
= "Purchase Order" ) {
myAbbr2 := "PO"
}
Else If ( DocumentType
= "Work Order" ) {
myAbbr2 := "WO"
}
Else If ( DocumentType
= "Check" ) {
myAbbr2 := "CK"
}
Else If ( DocumentType
= "Proofing Document" ) {
myAbbr2 := "PD"
}
Else If ( DocumentType
= "Film" ) {
myAbbr2 := "FF"
}
Else If ( DocumentType
= "Drop Ship Document" ) {
myAbbr2 := "DS"
}
; Handle "Initial Routing Direction" DDL.
If ( Direction
= "Sent Out" ) {
myAbbr3 := "S"
}
Else If ( Direction
= "Returned To Company" ) {
myAbbr3 := "R"
}
Else If ( Direction
= "File Only" ) {
myAbbr3 := "F"
}
; Format calendar to chosen datestamp.
FormatTime, myDate, % MyCalendar, yyyy-MM-dd
; Replace spaces with underscores if necessary.
; Build filename from user input.
myFilename := RefNo . "_" . Seq . "_-_(" . myAbbr1 . myAbbr2 . myAbbr3 . ")_" . Ownership . "_" . DocumentType . "_" . Direction . "_" . myDate
; Populate filename field.
SB_SetText( myFilename, 1 )
}
Clipboard:
{
Clipboard := myFilename
SB_SetText( "Filename copied to clipboard.", 1 )
SB_SetText( myFilename, 1 )
}
GuiClose:
GuiEscape:
{
Gui, Destroy
}