<< Click to Display Table of Contents >> Navigation: 3. Script Language > IXX. - Choose one of two cases > IXX-Commands: IF .. THEN ... ELSE ... ENDIF |
MiniRobotLanguage (MRL)
IFD. Conditional Statement
If File Date
Intention
Check if a filedate is older then ... or newer then whatever you specify.
Used to compare version information from files.
In P4 - Options, you specify which filedate to compare
a - last-access
c - creation date
w - last write (default)
Is the installed DLL or file older or newer?
This command will help you to solve this problem.
As parameters you can use the real filenames (with path) or the version-string.
' Syntax 1 does need | (separator-pipe)
IFD.?path\PR01.Exe|>=|?path\u9.exe|w
PRT. File 1 is newer or same date
ELS.
PRT. File 2 is newer
EIF.
' Syntax 2 does not need | (separator-pipe)
' but must therefore use Variables
IFD.§§FIA>§§FIB|c
PRT. File 1 is newer
ELS.
PRT. File 2 is newer
EIF.
You can also use the negative form of this statement: NFD. (If Not File Date)
Syntax
IFD.P1|P2|P3|P4]
Parameter Explanation
P1 - Filename 1 or version 1
P2 - compare-operation:
> < = ! => <=
P3 - Filename 2 or version 2
P4 - Options
a - last-access
c - creation date
w - last write (default, if omitted)
Example
''**********************************************
' IFD. - Sample
'**********************************************
'DBM.2
' Use Path to a existiing files
VAR.§§FIA=?exepath\MR01.Exe
VAR.§§FIB=?exepath\MRE.exe
PRT.===========================================
GFD.§§FIA
PRT.Date File 1: $$000
GFD.§§FIB|§§RES
PRT.Date File 2: §§RES
' Syntax 1 must use Variables
IFD.§§FIA>§§FIB|c
PRT. File 1 is newer
ELS.
PRT. File 2 is newer
EIF.
' Syntax 2 can use Text-Filenames
IFD.?path\PR01.Exe|>=|?path\u9.exe|w
PRT. File 1 is newer or same date
ELS.
PRT. File 2 is newer
EIF.
' We can compare files or File-Version
' Supported Operators:
' >,<,=,=>,<=,!
' In this case we compare date-strings
' these must have the format which is returned from
' GFD!
GFD.§§FIA|§§REA
GFD.§§FIB|§§REB
PRT. File 1: §§REA
PRT. File 2: §§REB
IFD.§§REA>§§REB|c
PRT. Is the case
ELS.
PRT. Is not the case
EIF.
PRT.===========================================
DMP.4
MBX.Ready
END.
Remarks
If you need to get the filedate, use GFD.
Limitations:
-
See also: