Code: Select all
'Page1
Dialog>DialogPage1
object DialogPage1: TForm
Left = 381
Top = 108
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Page1 - File browse'
ClientHeight = 226
ClientWidth = 688
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object lblDestination: TLabel
Left = 128
Top = 32
Width = 10
Height = 13
Caption = '//'
end
object lblSelectedFile: TLabel
Left = 128
Top = 80
Width = 10
Height = 13
Caption = '//'
end
object lblGeneric: TLabel
Left = 128
Top = 127
Width = 10
Height = 13
Caption = '//'
end
object Label1: TLabel
Left = 320
Top = 0
Width = 34
Height = 13
Caption = 'Page 1'
end
object btnBrowse: tMSButton
Left = 34
Top = 68
Width = 75
Height = 25
Cancel = True
Caption = 'Source file'
TabOrder = 0
DoBrowse = False
InitialDir = 'C:\Temp\'
BrowseStyle = fbOpen
end
object btnDestination: tMSButton
Left = 32
Top = 20
Width = 75
Height = 25
Caption = 'Destination'
TabOrder = 1
DoBrowse = False
InitialDir = 'C:\Temp\Temp'
BrowseStyle = fbFolder
end
object btnClose: tMSButton
Left = 33
Top = 185
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object btnNext: tMSButton
Left = 585
Top = 185
Width = 75
Height = 25
Caption = '&Next'
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>DialogPage1
'Page2
Dialog>DialogPage2
object DialogPage2: TForm
Left = 247
Top = 96
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Page2'
ClientHeight = 226
ClientWidth = 688
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object lblDestination: TLabel
Left = 128
Top = 32
Width = 10
Height = 13
Caption = '//'
end
object lblSelectedFile: TLabel
Left = 128
Top = 80
Width = 10
Height = 13
Caption = '//'
end
object lblGeneric: TLabel
Left = 128
Top = 127
Width = 10
Height = 13
Caption = '//'
end
object Label1: TLabel
Left = 312
Top = 2
Width = 34
Height = 13
Caption = 'Page 2'
end
object btnBrowse: tMSButton
Left = 34
Top = 68
Width = 75
Height = 25
Cancel = True
Caption = 'Source file'
TabOrder = 0
DoBrowse = False
InitialDir = 'C:\Temp\'
BrowseStyle = fbOpen
end
object btnDestination: tMSButton
Left = 32
Top = 20
Width = 75
Height = 25
Caption = 'Destination'
TabOrder = 1
DoBrowse = False
InitialDir = 'C:\Temp\Temp'
BrowseStyle = fbFolder
end
object btnClose: tMSButton
Left = 33
Top = 185
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object btnNext: tMSButton
Left = 585
Top = 185
Width = 75
Height = 25
Caption = '&Next'
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
object btnPrev: tMSButton
Left = 502
Top = 185
Width = 75
Height = 25
Caption = '&Previous'
TabOrder = 4
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>DialogPage2
'Page3
Dialog>DialogPage3
object DialogPage3: TForm
Left = 255
Top = 139
HelpContext = 5000
BorderIcons = [biSystemMenu]
Caption = 'Page3'
ClientHeight = 226
ClientWidth = 688
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
Position = poScreenCenter
ShowHint = True
OnTaskBar = False
PixelsPerInch = 96
TextHeight = 13
object lblDestination: TLabel
Left = 128
Top = 32
Width = 10
Height = 13
Caption = '//'
end
object lblSelectedFile: TLabel
Left = 128
Top = 80
Width = 10
Height = 13
Caption = '//'
end
object lblGeneric: TLabel
Left = 128
Top = 127
Width = 10
Height = 13
Caption = '//'
end
object Label1: TLabel
Left = 297
Top = 2
Width = 34
Height = 13
Caption = 'Page 3'
end
object btnBrowse: tMSButton
Left = 34
Top = 68
Width = 75
Height = 25
Cancel = True
Caption = 'Source file'
TabOrder = 0
DoBrowse = False
InitialDir = 'C:\Temp\'
BrowseStyle = fbOpen
end
object btnDestination: tMSButton
Left = 32
Top = 20
Width = 75
Height = 25
Caption = 'Destination'
TabOrder = 1
DoBrowse = False
InitialDir = 'C:\Temp\Temp'
BrowseStyle = fbFolder
end
object btnClose: tMSButton
Left = 33
Top = 185
Width = 75
Height = 25
Caption = 'Close'
TabOrder = 2
DoBrowse = False
BrowseStyle = fbOpen
end
object btnPrev: tMSButton
Left = 502
Top = 185
Width = 75
Height = 25
Caption = '&Previous'
TabOrder = 3
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>DialogPage3
'Page1
Label>pg1
GoSub>Page_1
'Page2
Label>pg2
GoSub>Page_2
If>prvPg=1
Let>prvPg=0
Goto>pg1
EndIf
'page3
Label>pg3
GoSub>Page_3
If>prvPg=1
Let>prvPg=0
Goto>pg2
EndIf
SRT>Page_1
Show>DialogPage1
'=======================
'DIALOG LOOP
'============
let>i=0
Label>dialogLoopPg1
Add>i,1
If>i<2
GoSub>AddEventPg1
GoSub>PopulatePg1
EndIf
Wait>0.1
'User selected a file
If>browseDone=1
'use this to flow on to other tasks if needed
'without the need to exit, set browseDone to 1(true)
Let>browseDone=0
CloseDialog>DialogPage1
Goto>endLoopPg1
EndIf
Goto>dialogLoopPg1
Label>endLoopPg1
'=======================
SRT>AddEventPg1
AddDialogHandler>DialogPage1,btnBrowse,OnClick,BrowsePg1
AddDialogHandler>DialogPage1,btnDestination,OnClick,SelectDestinationPg1
AddDialogHandler>DialogPage1,btnClose,OnClick,CloseDialogPg1
AddDialogHandler>DialogPage1,btnNext,OnClick,NextDialogPg1
END>AddEventPg1
SRT>PopulatePg1
GetDialogProperty>DialogPage1,btnDestination,InitialDir,dirDestination
SetDialogProperty>DialogPage1,lblDestination,Caption,%dirDestination%
END>PopulatePg1
SRT>BrowsePg1
SetDialogProperty>DialogPage1,btnBrowse,DoBrowse,True
GetDialogProperty>DialogPage1,btnBrowse,Filename,userFileName
SetDialogProperty>DialogPage1,btnBrowse,DoBrowse,False
Length>%userFileName%,Chk_Len
If>Chk_Len>0
GoSub>NameAtrbsPg1
Length>%dirDestination%,Chk_Len
If>Chk_Len>0
'overwrite existing file if exists
Let>CF_OVERWRITE=1
CopyFile>%userFileName%,%dirDestination%\
If>CF_RESULT_CODE=0
ExtractFileName>%userFileName%,strFileName
RenameFile>%dirDestination%\%strFileName%,%dirDestination%\%newFileAttrbs%_%strFileName%
'file
SetDialogProperty>DialogPage1,lblSelectedFile,Caption,%userFileName%
SetDialogProperty>DialogPage1,lblGeneric,Caption,Copy and rename was Successful!%CRLF%%CRLF%%dirDestination%\%newFileAttrbs%_%strFileName%
SetDialogProperty>DialogPage1,btnBrowse,Filename,%userFileName%
Else
'CF_RESULT
SetDialogProperty>DialogPage1,lblGeneric,Caption,ERROR! %CF_RESULT_CODE%
EndIf
Else
'select destination
SetDialogProperty>DialogPage1,lblDestination,Caption,Select destination...
EndIf
Else
SetDialogProperty>DialogPage1,lblGeneric,Caption,No file selected!
EndIf
END>BrowsePg1
SRT>SelectDestinationPg1
SetDialogProperty>DialogPage1,btnDestination,DoBrowse,True
GetDialogProperty>DialogPage1,btnDestination,Filename,dirDestination
Length>%dirDestination%,Chk_Len
If>Chk_Len>0
SetDialogProperty>DialogPage1,lblDestination,Caption,%dirDestination%
Else
'select destination
SetDialogProperty>DialogPage1,lblDestination,Caption,Select destination...
EndIf
END>SelectDestinationPg1
SRT>NameAtrbsPg1
'define new file name atributes
Sec>secs
Min>mins
Hour>hour
Day>day
Month>month
Year>year
Random>1000,genRan
Let>newFileAttrbs=%secs%%mins%%hour%%day%%month%%year%_%genRan%
END>NameAtrbsPg1
SRT>CloseDialogPg1
Exit>
END>CloseDialogPg1
SRT>NextDialogPg1
Let>browseDone=1
END>NextDialogPg1
END>Page_1
SRT>Page_2
Show>DialogPage2
'=======================
'DIALOG LOOP
'============
let>i=0
Label>dialogLoopPg2
Add>i,1
If>i<2
GoSub>AddEventPg2
GoSub>PopulatePg2
EndIf
Wait>0.1
'User selected a file
If>browseDone=1
'use this to flow on to other tasks if needed
'without the need to exit, set browseDone to 1(true)
Let>browseDone=0
CloseDialog>DialogPage2
Goto>endLoopPg2
EndIf
Goto>dialogLoopPg2
Label>endLoopPg2
'=======================
SRT>AddEventPg2
AddDialogHandler>DialogPage2,btnBrowse,OnClick,BrowsePg2
AddDialogHandler>DialogPage2,btnDestination,OnClick,SelectDestinationPg2
AddDialogHandler>DialogPage2,btnClose,OnClick,CloseDialogPg2
AddDialogHandler>DialogPage2,btnNext,OnClick,NextDialogPg2
AddDialogHandler>DialogPage2,btnPrev,OnClick,PrevDialogPg2
END>AddEventPg2
SRT>PopulatePg2
GetDialogProperty>DialogPage2,btnDestination,InitialDir,dirDestination
SetDialogProperty>DialogPage2,lblDestination,Caption,%dirDestination%
END>PopulatePg2
SRT>BrowsePg2
SetDialogProperty>DialogPage2,btnBrowse,DoBrowse,True
GetDialogProperty>DialogPage2,btnBrowse,Filename,userFileName
SetDialogProperty>DialogPage2,btnBrowse,DoBrowse,False
Length>%userFileName%,Chk_Len
If>Chk_Len>0
GoSub>NameAtrbsPg2
Length>%dirDestination%,Chk_Len
If>Chk_Len>0
'overwrite existing file if exists
Let>CF_OVERWRITE=1
CopyFile>%userFileName%,%dirDestination%\
If>CF_RESULT_CODE=0
ExtractFileName>%userFileName%,strFileName
RenameFile>%dirDestination%\%strFileName%,%dirDestination%\%newFileAttrbs%_%strFileName%
'file
SetDialogProperty>DialogPage2,lblSelectedFile,Caption,%userFileName%
SetDialogProperty>DialogPage2,lblGeneric,Caption,Copy and rename was Successful!%CRLF%%CRLF%%dirDestination%\%newFileAttrbs%_%strFileName%
SetDialogProperty>DialogPage2,btnBrowse,Filename,%userFileName%
Else
'CF_RESULT
SetDialogProperty>DialogPage2,lblGeneric,Caption,ERROR! %CF_RESULT_CODE%
EndIf
Else
'select destination
SetDialogProperty>DialogPage2,lblDestination,Caption,Select destination...
EndIf
Else
SetDialogProperty>DialogPage2,lblGeneric,Caption,No file selected!
EndIf
END>BrowsePg2
SRT>SelectDestinationPg2
SetDialogProperty>DialogPage2,btnDestination,DoBrowse,True
GetDialogProperty>DialogPage2,btnDestination,Filename,dirDestination
Length>%dirDestination%,Chk_Len
If>Chk_Len>0
SetDialogProperty>DialogPage2,lblDestination,Caption,%dirDestination%
Else
'select destination
SetDialogProperty>DialogPage2,lblDestination,Caption,Select destination...
EndIf
END>SelectDestinationPg2
SRT>NameAtrbsPg2
'define new file name atributes
Sec>secs
Min>mins
Hour>hour
Day>day
Month>month
Year>year
Random>1000,genRan
Let>newFileAttrbs=%secs%%mins%%hour%%day%%month%%year%_%genRan%
END>NameAtrbsPg2
SRT>CloseDialogPg2
Exit>
END>CloseDialogPg2
SRT>PrevDialogPg2
Let>browseDone=1
Let>prvPg=1
END>PrevDialogPg2
SRT>NextDialogPg2
Let>browseDone=1
END>NextDialogPg2
END>Page_2
SRT>Page_3
Show>DialogPage3
'=======================
'DIALOG LOOP
'============
let>i=0
Label>dialogLoopPg3
Add>i,1
If>i<2
GoSub>AddEventPg3
GoSub>PopulatePg3
EndIf
Wait>0.1
'User selected a file
If>browseDone=1
'use this to flow on to other tasks if needed
'without the need to exit, set browseDone to 1(true)
Let>browseDone=0
CloseDialog>DialogPage3
Goto>endLoopPg3
EndIf
Goto>dialogLoopPg3
Label>endLoopPg3
'=======================
SRT>AddEventPg3
AddDialogHandler>DialogPage3,btnBrowse,OnClick,BrowsePg3
AddDialogHandler>DialogPage3,btnDestination,OnClick,SelectDestinationPg3
AddDialogHandler>DialogPage3,btnClose,OnClick,CloseDialogPg3
AddDialogHandler>DialogPage3,btnPrev,OnClick,PrevDialogPg3
END>AddEventPg3
SRT>PopulatePg3
GetDialogProperty>DialogPage3,btnDestination,InitialDir,dirDestination
SetDialogProperty>DialogPage3,lblDestination,Caption,%dirDestination%
END>PopulatePg3
SRT>BrowsePg3
SetDialogProperty>DialogPage3,btnBrowse,DoBrowse,True
GetDialogProperty>DialogPage3,btnBrowse,Filename,userFileName
SetDialogProperty>DialogPage3,btnBrowse,DoBrowse,False
Length>%userFileName%,Chk_Len
If>Chk_Len>0
GoSub>NameAtrbsPg3
Length>%dirDestination%,Chk_Len
If>Chk_Len>0
'overwrite existing file if exists
Let>CF_OVERWRITE=1
CopyFile>%userFileName%,%dirDestination%\
If>CF_RESULT_CODE=0
ExtractFileName>%userFileName%,strFileName
RenameFile>%dirDestination%\%strFileName%,%dirDestination%\%newFileAttrbs%_%strFileName%
'file
SetDialogProperty>DialogPage3,lblSelectedFile,Caption,%userFileName%
SetDialogProperty>DialogPage3,lblGeneric,Caption,Copy and rename was Successful!%CRLF%%CRLF%%dirDestination%\%newFileAttrbs%_%strFileName%
SetDialogProperty>DialogPage3,btnBrowse,Filename,%userFileName%
Else
'CF_RESULT
SetDialogProperty>DialogPage3,lblGeneric,Caption,ERROR! %CF_RESULT_CODE%
EndIf
Else
'select destination
SetDialogProperty>DialogPage3,lblDestination,Caption,Select destination...
EndIf
Else
SetDialogProperty>DialogPage3,lblGeneric,Caption,No file selected!
EndIf
END>BrowsePg3
SRT>SelectDestinationPg3
SetDialogProperty>DialogPage3,btnDestination,DoBrowse,True
GetDialogProperty>DialogPage3,btnDestination,Filename,dirDestination
Length>%dirDestination%,Chk_Len
If>Chk_Len>0
SetDialogProperty>DialogPage3,lblDestination,Caption,%dirDestination%
Else
'select destination
SetDialogProperty>DialogPage3,lblDestination,Caption,Select destination...
EndIf
END>SelectDestinationPg3
SRT>NameAtrbsPg3
'define new file name atributes
Sec>secs
Min>mins
Hour>hour
Day>day
Month>month
Year>year
Random>1000,genRan
Let>newFileAttrbs=%secs%%mins%%hour%%day%%month%%year%_%genRan%
END>NameAtrbsPg3
SRT>CloseDialogPg3
Exit>
END>CloseDialogPg3
SRT>PrevDialogPg3
Let>browseDone=1
Let>prvPg=1
END>PrevDialogPg3
END>Page_3