Author Topic: Files with longest history  (Read 1391 times)

sinus

  • Global Moderator
  • *****
  • Posts: 4489
  • IMatch-User since 2001 (IMatch 3.6)
Files with longest history
« on: September 22, 2015, 10:54:44 AM »
Hi all
To be honest, I am a bit lazy now, I am asking without really searching for.

All files has a history. Is there a way to find files with the longest history?
Because then I could the images with long histories, therefore they must be a kind of important (or nonsense) and I could look at them deeper.

Best wishes from Switzerland! :-)
Markus

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Files with longest history
« Reply #1 on: September 22, 2015, 11:24:53 AM »
What is the 'longest' history? The files with the most entries in the history? The files with the oldest entries in the history?

Anyway, there is no built-in function which determines the files with the longest history - or anything related to histories. Also remember that IMatch purges histories automatically, removing older entries as configured by you (see the History topic in the help for more info).

You can access file histories easily from a script (there is a sample script which shows how to do this). This allows you to iterate over all files in your database, find the ones with the longest history and then display them, put them into a category, whatever.

Use this for a start:

Code: [Select]
'#Language "WWB-COM"
Option Explicit

Sub Main
Debug.Clear

Dim hist As FileHistory

Dim sel As Files
Set sel = Application.GetFileWindow(imfwtCurrent).SelectedFiles
Dim f As File

Dim pd As New IMProgressDialog
pd.Create "Counting","File History Checker",0,sel.Count,True

For Each f In sel

pd.Step
If pd.Canceled Then
Exit For
End If

Set hist = f.History
Debug.Print f.FileName; hist.Count; " entries."
Next

pd.Close

End Sub

This script dumps the names and number of history entries for each file selected in the file window into the debug scripting output panel.

sinus

  • Global Moderator
  • *****
  • Posts: 4489
  • IMatch-User since 2001 (IMatch 3.6)
Re: Files with longest history
« Reply #2 on: September 22, 2015, 12:07:20 PM »
What is the 'longest' history? The files with the most entries in the history? The files with the oldest entries in the history?
 
Yes, I thought at the files with the most entries in the history.
Thanks a lot for your example - script.  :D
This is very useful for me!

Best wishes from Switzerland! :-)
Markus