Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Подсветка по разнице дат у двух файлов 
Author Message
valexiev



PostPosted: Thu Feb 15, 2007 03:14    Post subject: Изчисление разницъ дней до "базового" файла Reply with quote

Batya wrote:
Нужно использовать Script Content Plugin.

Вот ето да! Попробую (никогда не жаль употребить 3-4ч на автоматицазию которая потом может сохранить мне аж 3-4 минутъ! Smile)

Quote:
Только для скрипта нужны более четкие условия.


Условия такие: на каждъй основной файл у меня еще 4 "QR" файла (ето вам PRINCE2)
Code:
mPay2 DOC M.1.PM 1.0 - Project Mandate.doc
mPay2 DOC M.1.PM 1.0 QR001 Quality Review Sign-off.doc
mPay2 DOC M.1.PM 1.0 QREL001-1 Quality Review Error List.doc
mPay2 DOC M.1.PM 1.0 QRFAL001-1 Quality Review Follow-up Action List.doc

Хочу раскрасить QR файлъ которъе не новее основного файла.

Quote:
По каким условиям точно сопоставить эти два файла?

Одинаковое начало имени, до "QR".

Так.. написал, и даже работает!
Code:

'Script for Script_WDX
' (c) Vladimir Alexiev <vladimir@sirma.bg>

' Given a "QR" file such as
' mPay2 DOC M.1.PM 1.0 QR001 Quality Review Sign-off.doc
' Find the "base file" such as
' mPay2 DOC M.1.PM 1.0 - Project Mandate.doc
' And then return the date difference between the "QR" and "base" file in days.
' Also returns a sign (+) or (-) depending on whether the difference is >=5d or less.
' For example: 0 (-), 4 (-), 5(+), 10 (+)

'filename = "mPay2 DOC M.1.PM 1.0 QR001 Quality Review Sign-off.doc"

content = ""

set re = new regexp
set reNotbase = new regexp
re.pattern = "^(.* )1\.0 QR(FAL)?0" ' interesting QR files
reNotbase.pattern = "^(.* )1\.0 QR" ' not "base" files: these are all QR files
set matches = re.execute (filename)

if matches.count > 0 then
  prefix = matches(0).submatches(0)
  set fso = CreateObject("Scripting.FileSystemObject")
  for each basefile in fso.getFolder(".").files
    basename = basefile.name
    if prefix = left (basename, len(prefix)) and not reNotbase.test(basename) then
      dat = fso.getFile(filename).dateLastModified
      basedat = fso.GetFile(basename).dateLastModified
      diff = DateDiff ("d", basedat, dat) ' or "h" for hours
      if diff < 5 then
        sign = "(-)"
      else
        sign = "(+)"
      end if
      content = diff & " " & sign
      exit for
    end if
  next
  set fso = nothing
end if

set matches = nothing
set re = nothing
set reNotbase = nothing

'msgbox content


script.ini:
Code:

[QR-date-diff]
Script=QR-date-diff.vbs
LongName=0
ParseDirs=0
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group