as requested, attached is the complete script I was playing with.
As you can see I've just added a loop to the top of Skwires script to check for the existence of file save dialogs...
you should be able to use save in lieue of save as, though I haven't played with this
it also occurs to me that there is no need to destroy the gui each time as hide/show has the same effect. The bonus with this is that the last use is persistent, ie you can see the last entry (note that this could be coded in anyway)
#singleinstance
Loop
{
ifwinactive, Save As ;should work with just save, but i haven't tried it - note that you would need to change the other instances as well
{
gosub filename
winwaitclose, Save As
}
ifwinnotexist, Save As
gui, destroy
Sleep, 1500
}
FileName:
^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
}
Return
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.
StringReplace, Ownership , Ownership , %A_Space%, _, All
StringReplace, DocumentType, DocumentType, %A_Space%, _, All
StringReplace, Direction , Direction , %A_Space%, _, All
; Build filename from user input.
myFilename := RefNo . "_" . Seq . "_-_(" . myAbbr1 . myAbbr2 . myAbbr3 . ")_" . Ownership . "_" . DocumentType . "_" . Direction . "_" . myDate
; Populate filename field.
SB_SetText( myFilename, 1 )
}
Return
Clipboard:
{
Clipboard := myFilename
SB_SetText( "Filename copied to clipboard.", 1 )
Sleep, 1500
SB_SetText( myFilename, 1 )
}
Return
GuiClose:
GuiEscape:
{
Gui, Destroy
}
Return