MRT: TODAY Date and date refreshing

English support forum

Moderators: white, Hacker, petermad, Stefan2

zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

MRT: TODAY Date and date refreshing

Post by *zuccadoc »

Hi Everybody,
Sorry for the stupid question but:

Can I use the today date (format YMD) in MRT? How?

In the paste I solve the problem with [=tc.accessdate.YMD] but I´m seeing that it doesn´t corresponds always with the Today date. What is it exactly?
I don´t know why but on my C: and D: disk [=tc.accessdate.YMD] works as Today date, on my external disk G: it spits out somwthing else...May be my Vista x64 is crazy... :roll: (I´m sure that the TC 7.02a is not crazy)

By the way the dream would be (supposing 20080403 the YMD Today date):

1st Case) Add a Today YMD in front a file/directory
(ex. "file1.xyz" ---> "20080403 file1.xyz")

2nd Case) Refresh an old Date
(ex. "20060504 file2.xyz" ---> "20080403 file2.xyz")

in just one step without to select the items with old date to refresh (with rename mask [=tc.accessdate.YMD][N9-]) and then the others (with rename mask [=tc.accessdate.YMD] [N]). Any idea? I´m imaging something like:

if ("file or directory" starts with 8 numbers [old date] followed by a space) then
replace the 8 numbers with the today date
else
just add the TODAY Date YMD format followed by a space and the file/directory name
endif

Thanks and sorry for my poor english.

Z
I follow the truth.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

It could be done with a custom plugin very easily, but unfortunately I'm not aware of any such plugin.

Maybe someone could write a short VB Script for the script plugin:
http://www.totalcmd.net/plugring/script_wdx.html
Author of Total Commander
https://www.ghisler.com
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

ghisler(Author) wrote:Maybe someone could write a short VB Script for the script plugin:
Great idea, thanks a lot for the hint. Here is the short script for this (quick and dirty, but tested in MRT):
Now.vbs (updated, see edit section below in this post)

Code: Select all

'///////////////////////////////////////////////////
' NOW v0.2 (W) StatusQuo 2008
' small VBS-script for TC content plugin SCRIPT.WDX
'///////////////////////////////////////////////////
' Purpose:
' --------
' Returns the current system date & time.
'
' Usage in MRT, Alt+F7 search etc.:
' -----
' - install script plugin: http://www.totalcmd.net/plugring/script_wdx.html
' - in script.ini (in the plugin-dir) include this file like this (without leading "'"):
'[Now]
'Script=Now.vbs
'LongName=0
'ParseDirs=1
'
' - in script.ini (again) change the file beginning to use the new section:
'[Script]
'Section=Now
'
' - to use result number 3 below (YMD-HmS, e.g. 20080403-221957) enter in TC:
'[=script.Result5]
' - for YMD format use
'[=script.Result1]
' or
'[=script.Result]
'///////////////////////////////////////////////////
   
content1=Year(Date)     & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2)   ' YMD
content2=Left(Time, 2)  &  Mid(Time, 4, 2)            & Right(Time, 2)              ' HmS
content3=content1 & "-" & content3                                                  ' YMD-HmS

content4=Year(Date)     & Right("0" & Day(Date), 2)   & Right("0" & Month(Date), 2) ' YDM
content5=content4 & "-" & content2                                                  ' YDM-HmS

content =content1                                                                   ' YMD
Just for information, the first version was:

Code: Select all

content1=Right(Date, 4) &  Mid(Date, 4, 2) &  Left(Date, 2)    ' YMD
content2= Left(Time, 2) &  Mid(Time, 4, 2) & Right(Time, 2)    ' HmS
content3=content1 & "-" & content3                             ' YMD-HmS

content4=Right(Date, 4) & Left(Date, 2)    &   Mid(Date, 4, 2) ' YDM
content5=content4 & "-" & content2                             ' YDM-HmS

content =content1                                              ' YMD
[Edit]
- added ParseDirs key to the info about script.ini to make it work with directories, too
- added sqa_wizard's improvement on extracting the date numbers
[/Edit]
Last edited by StatusQuo on 2008-04-09, 19:05 UTC, edited 1 time in total.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

2StatusQuo
Wow, really quick !

... and a little bit dirty of course ;)
It depends on the fixed date result notation DD.MM.YYYY

To be more flexible you may use :

Code: Select all

content1=Year(Date) & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2) ' YMD
content2= Left(Time, 2) &  Mid(Time, 4, 2) & Right(Time, 2)                   ' HmS
content3=content1 & "-" & content3                                            ' YMD-HmS

content4=Year(Date) & Right("0" & Day(Date), 2) & Right("0" & Month(Date), 2) ' YDM
content5=content4 & "-" & content2                                            ' YDM-HmS

content =content1                                                             ' YMD
#5767 Personal license
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2sqa_wizard
Nice and much more elegant, thanks.
I guess that makes content4 and content5 obsolete (these were added to handle this).
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

I guess that makes content4 and content5 obsolete
Deleting is always easier than creating ;)
#5767 Personal license
zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

Post by *zuccadoc »

Thanks Everybody!

But it doesn´t work on my PC! :(

I need one more time your help... :oops:

I installed the script plugin (it was automatic installed by TC) and put a Now.vbs in the script directory

This is my script.ini

Code: Select all

[Script]
Section=Now
;js
;Extension
;exe-arc up
;AddZeros

[Defaults]
LongName=1
ParseDirs=0

[Extension]
Script=ext.vbs

[AddZeros]
Script=AddZeros.vbs
LongName=0

[exe-arc up]
Script=Exeup.vbs
LongName=0

[js]
Script=java.js
LongName=0

[Now]
Script=Now.vbs
LongName=0 
and my Now.vbs

Code: Select all

'///////////////////////////////////////////////////
' NOW v0.1 (W) StatusQuo 2008
' small VBS-script for TC content plugin SCRIPT.WDX
'///////////////////////////////////////////////////
' Purpose:
' --------
' Returns the current system date & time.
'
' Usage in MRT, Alt+F7 search etc.:
' -----
' - install script plugin: http://www.totalcmd.net/plugring/script_wdx.html
' - in script.ini (in the plugin-dir) include this file like this (without leading "'"):
'[Now]
'Script=Now.vbs
'LongName=0
'
' - in script.ini (again) change the file beginning to use the new section:
'[Script]
'Section=Now
'
' - to use result number 3 below (YMD-HmS, e.g. 20080403-221957) enter in TC:
'[=script.Result5]
' - for YMD format use
'[=script.Result1]
' or
'[=script.Result]
'///////////////////////////////////////////////////
   
content1=Year(Date) & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2) ' YMD
content2= Left(Time, 2) &  Mid(Time, 4, 2) & Right(Time, 2)                   ' HmS
content3=content1 & "-" & content3                                            ' YMD-HmS

content4=Year(Date) & Right("0" & Day(Date), 2) & Right("0" & Month(Date), 2) ' YDM
content5=content4 & "-" & content2                                            ' YDM-HmS

content =content1                                                             ' YMD 
I use the 7.02a and Vista x64.

Do I need to install VB or have any VB.dll?

Z
I follow the truth.
zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

Post by *zuccadoc »

Ladies and Gentlemen,

Now It works but I don´t know why. I change nothing.

God exists.

Thanks Everybody!

Z
I follow the truth.
zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

Post by *zuccadoc »

The Big Illusion...

:shock:

Now it doesn´t work. I tried also on another PC.
No mercy. It returns always <Error!> in MRT.

I´m using the code that I posted before.

I´m back on monday.

Thanks in advance,

Z
I follow the truth.
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

zuccadoc wrote:7.02a and Vista x64.

Do I need to install VB or have any VB.dll?
I don't think so. VBS files are normally interpreted by
%SystemRoot%\system32\wscript.exe.
I even renamed this file, but the script still worked like before.
In the script-plugin documentation I found no different statement.

To make sure you have exactly the same copy of the script, below it is once again UUEncoded (Now.uue - decode with TC using File -> decode).
I hope this helps.
If not, maybe Vista x64 is a problem - I only have 32bit OS's (and no Vista) here for testing, with TC 7.02a, too...

Code: Select all

begin 644 Now.vbs
M)R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O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R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+PT*("`@#0IC;VYT96YT
M,3U996%R*$1A=&4I("`@("`F(%)I9VAT*"(P(B`F($UO;G1H*$1A=&4I+"`R
M*2`F(%)I9VAT*"(P(B`F($1A>2A$871E*2P@,BD@("`G(%E-1`T*8V]N=&5N
M=#(]3&5F="A4:6UE+"`R*2`@)B`@36ED*%1I;64L(#0L(#(I("`@("`@("`@
M("`@)B!2:6=H="A4:6UE+"`R*2`@("`@("`@("`@("`@)R!(;5,-"F-O;G1E
M;G0S/6-O;G1E;G0Q("8@(BTB("8@8V]N=&5N=#,@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("<@64U$+4AM4PT*
M#0IC;VYT96YT-#U996%R*$1A=&4I("`@("`F(%)I9VAT*"(P(B`F($1A>2A$
M871E*2P@,BD@("`F(%)I9VAT*"(P(B`F($UO;G1H*$1A=&4I+"`R*2`G(%E$
M30T*8V]N=&5N=#4]8V]N=&5N=#0@)B`B+2(@)B!C;VYT96YT,B`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@)R!9
M1$TM2&U3#0H-"F-O;G1E;G0@/6-O;G1E;G0Q("`@("`@("`@("`@("`@("`@
M("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
+("`@("<@64U$#0H`
`
end
sum -r/size 47258/1406
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

Post by *zuccadoc »

Thanks StatusQuo,

sorry for my delayed post but it was an epic Weekend.

Finally I tried your script with Winxp 32 (with UUEncoded also) and I understood something more...

On both OS (Vista 64 and WinXP 32):

1) When I tried to rename a Directory it doesn´t work
2) With a file no problem.

No idea why... :roll:
I follow the truth.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3854
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

When I tried to rename a Directory it doesn´t work
You cannot rename any directory if there is something in use within this directory (or its subdirectories) !

This could be an open file (used by an application) or even TC itself displaying its content at an active pane ...
#5767 Personal license
zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

Post by *zuccadoc »

Hi sqa_wizard:

Followiong:

-1 I select a X directory

-2 in MRT I try to rename X with mask [N]_dummy.

-3 It works and the result is X_dummy

-4 I rename the directorx X_dummy in X

-5 I select the X directory again

-6 in MRT I try to rename X with mask [N]_[=script.Result].

-7 <Error!> appears in the new name column

-8 if I delete the "[=script.Result]" part from the rename mask the <Error!> disappear.

with a file and not a directory It works with no problem.
You cannot rename any directory if there is something in use within this directory (or its subdirectories) !
It´s true but it isn´t the problem.

Thanks

Z
I follow the truth.
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2zuccadoc
I can reproduce this, I get an error on dirs here, too, using Win2k. It is displayed in MRT before starting any renaming action.
As this also occurs with a script content as simple as "content=1" I think this is a problem in the plugin.

I posted this into the script plugin thread, hoping to get a solution...
http://www.ghisler.ch/board/viewtopic.php?p=147219#147219
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
zuccadoc
Junior Member
Junior Member
Posts: 20
Joined: 2008-03-14, 08:40 UTC

Post by *zuccadoc »

Here the wincmd.ini [rename] part (copy/paste in the wincmd.ini file) with 3 Settings (in MRT push F2 or Menu F2 Load/Save Settings):

- Add Today: just add Today in YMD with a blank space and the name
- Ref Today: refreshing an old date with the today value
- Rem Date: Remove the date in front of the item.

Thanks to all!

Enjoy,

Z

Code: Select all

[rename]
Add Today_name="[=script.Result] [N]"
Add Today_ext="[E]"
Add Today_search=""
Add Today_replace=""
Add Today_params=0|1|1|1
Ref Today_name="[=script.Result][N9-]"
Ref Today_ext="[E]"
Ref Today_search=""
Ref Today_replace=""
Ref Today_params=0|1|1|1
Rem Date_name="[N10-]"
Rem Date_ext="[E]"
Rem Date_search=""
Rem Date_replace=""
Rem Date_params=0|1|1|1
I follow the truth.
Post Reply