Announcement

Collapse
No announcement yet.

Date Compare

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Date Compare

    I'm trying to do a date comparison between 2 files after which I will perform and upgrade if one file is later than the other.

    Can anyone help? I've tried CRC compare but that only tells me that the files are DIFFERENT but not if oone is older than the other.

  • #2
    Re: Date Compare

    I am sure someone will come up with a .dll or fancy of telling what the date is, but here is my down and dirty way.

    I would write a batch file that would perform a dir command on the file itself. Outupt this to a file, and then extract the date from the text file to do your comparison.

    Here is a post where something similar was performed using a batch file created by AMS.

    http://www.indigorose.com/ubbthreads...mp;o=&vc=1

    Here is something like what I mean

    %FullPath% = Dialog.FileBrowse (Open, "File Open", "%SysDrv%", "All Files (*.*)|*.*|")
    %NewString% = String.ParsePath ("%FullPath%", Filename)
    %DumpFile% = "%TempDir%\DirDump.txt"
    TextFile.Write ("%TempDir%\DirDump.bat", "@echo off Dir %FullPath% >"%DumpFile%" exit")
    File.Execute ("%TempDir%\DirDump.bat", "", Wait)
    %LineNumber% = TextFile.FindLine ("%DumpFile%","%NewString%", 0)
    IF (%LineNumber% = -1)
    %Result% = Dialog.MessageBox ("ERROR", "Your file %NewString% was not ...", Ok, Exclamation)
    ELSE
    %TextLine% = TextFile.GetLine ("%DumpFile%", %LineNumber%)
    %SubString% = String.Left ("%TextLine%", 10)
    %Month% = String.GetDelimitedString ("%SubString%", "/", 0)
    %Day% = String.GetDelimitedString ("%SubString%", "/", 1)
    %Year% = String.GetDelimitedString ("%SubString%", "/", 2)
    %Result% = Dialog.MessageBox ("Title", "Text Line = %TextLine% SubStr...", Ok, Question)
    END IF
    File.Delete ("%TempDir%\DirDump.*")

    Here is the action code you can cut and paste

    <IR_ACTIONS_LIST>
    <Action name="File Browse">
    <Type>54</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <DefaultDirectory>%SysDrv%</DefaultDirectory>
    <DefaultFileName/>
    <DefaultFileExtenstion/>
    <FileFilter>All Files (*.*)|*.*|</FileFilter>
    <AllowMultipleSelect>0</AllowMultipleSelect>
    <FileMustExist>1</FileMustExist>
    <Variable>%FullPath%</Variable>
    <DialogTitle>File Open</DialogTitle>
    <DialogType>0</DialogType>
    </Action>
    <Action name="Parse Path">
    <Type>62</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%NewString%</Variable>
    <Source>%FullPath%</Source>
    <ParseType>4</ParseType>
    </Action>
    <Action name="Set Value">
    <Type>6</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>0</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%DumpFile%</Variable>
    <Value>%TempDir%\DirDump.txt</Value>
    <Evaluate>0</Evaluate>
    </Action>
    <Action name="Write">
    <Type>32</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>0</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <FileName>%TempDir%\DirDump.bat</FileName>
    <DataToWrite>@echo off
    Dir %FullPath% &amp;gt;"%DumpFile%"
    exit</DataToWrite>
    <IfFileExists>0</IfFileExists>
    </Action>
    <Action name="Execute">
    <Type>8</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>0</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <FileName>%TempDir%\DirDump.bat</FileName>
    <CommandLine/>
    <WorkingDir/>
    <RunMode>1</RunMode>
    <WaitForReturn>1</WaitForReturn>
    </Action>
    <Action name="Find Line">
    <Type>57</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <FileName>%DumpFile%</FileName>
    <SearchText>%NewString%</SearchText>
    <StartAtLineNumber>0</StartAtLineNumber>
    <Variable>%LineNumber%</Variable>
    </Action>
    <Action name="IF">
    <Type>200</Type>
    <Function>1</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Condition>%LineNumber% = -1</Condition>
    </Action>
    <Action name="Message Box">
    <Type>5</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <DialogTitle>ERROR</DialogTitle>
    <DialogMessage>Your file %NewString% was not found in the file.</DialogMessage>
    <Icon>1</Icon>
    <Variable>%Result%</Variable>
    <DialogType>0</DialogType>
    <DefaultButton>0</DefaultButton>
    </Action>
    <Action name="ELSE">
    <Type>206</Type>
    <Function>1</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    </Action>
    <Action name="Get Line">
    <Type>58</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <FileName>%DumpFile%</FileName>
    <LineNumber>%LineNumber%</LineNumber>
    <Variable>%TextLine%</Variable>
    </Action>
    <Action name="Left">
    <Type>22</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%SubString%</Variable>
    <SourceString>%TextLine%</SourceString>
    <NumberOfCharacters>10</NumberOfCharacters>
    </Action>
    <Action name="Get Delimited String">
    <Type>64</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%Month%</Variable>
    <Source>%SubString%</Source>
    <Delimiter>/</Delimiter>
    <ItemIndex>0</ItemIndex>
    </Action>
    <Action name="Get Delimited String">
    <Type>64</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%Day%</Variable>
    <Source>%SubString%</Source>
    <Delimiter>/</Delimiter>
    <ItemIndex>1</ItemIndex>
    </Action>
    <Action name="Get Delimited String">
    <Type>64</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Variable>%Year%</Variable>
    <Source>%SubString%</Source>
    <Delimiter>/</Delimiter>
    <ItemIndex>2</ItemIndex>
    </Action>
    <Action name="Message Box">
    <Type>5</Type>
    <Function>0</Function>
    <DTIndentLevel>1</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <DialogTitle>Title</DialogTitle>
    <DialogMessage>Text Line = %TextLine%
    SubString = %SubString%
    Month = %Month%
    Day = %Day%
    Year = %Year%</DialogMessage>
    <Icon>3</Icon>
    <Variable>%Result%</Variable>
    <DialogType>0</DialogType>
    <DefaultButton>0</DefaultButton>
    </Action>
    <Action name="END IF">
    <Type>201</Type>
    <Function>1</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>2</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    </Action>
    <Action name="Delete">
    <Type>26</Type>
    <Function>0</Function>
    <DTIndentLevel>0</DTIndentLevel>
    <Enabled>1</Enabled>
    <ErrorHandling>
    <UserNotificationMode>0</UserNotificationMode>
    <CustomErrorMessage/>
    <OnErrorAction>0</OnErrorAction>
    <JumpToLabel/>
    </ErrorHandling>
    <Source>%TempDir%\DirDump.*</Source>
    <RecurseSubdirectories>0</RecurseSubdirectories>
    <ContinueAfterFail>1</ContinueAfterFail>
    <DeleteHiddenSystem>1</DeleteHiddenSystem>
    <DialogTitle>File Cleanup</DialogTitle>
    <DialogText>Deleting Temporary Files.</DialogText>
    </Action>
    </IR_ACTIONS_LIST>
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

    Comment


    • #3
      Re: Date Compare

      Thanks Tigger I'll give that a try !

      Comment

      Working...
      X