Set Selected file to Current Date with AutoHotkey

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
jinsight
Senior Member
Senior Member
Posts: 299
Joined: 2003-02-25, 19:47 UTC
Location: Wooster, Ohio, USA

Set Selected file to Current Date with AutoHotkey

Post by *jinsight »

I want to select a file or files and then run a macro to set those files to the current date by using Alt-A, u for current date and the enter key.

As a beginner, I tried to record an AutoHotkey macro but could not get it to work.

Can anyone offer the AutoHotkey code for this?

Thanks in advance for any assistance.
License #1945
Windows 10 Pro x64
Version 22H2 (OS Build 19045.3930)
TC 11.00 x64 and x86, Everything 1.5.0.1366a x64, QAP 11.6.3.1 x64
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Re: Set Selected file to Current Date with AutoHotkey

Post by *Gral »

Does it necessarily have to be AHK script?
You can do it easy with TC 10 without any external tool.

1. Define user command or just add such a code to USERCMD.INI

Code: Select all

[em_setcurrenttime]
button=%COMMANDER_EXE%,24
cmd=OPENATTRIBUTES
param==+c
2. Define hotkey for this command.
User avatar
petermad
Power Member
Power Member
Posts: 16116
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Set Selected file to Current Date with AutoHotkey

Post by *petermad »

2jinsight
No need for AHK for that.

Open your usercmd.ini file (located in the same directory as you wincmd.ini file - if not the make it in Notepad) and add this:

Code: Select all

[em_setcurrenttime]
cmd=OPENATTRIBUTES= +c
In TC go to "Configuration" -> "Options..." -> "Misc" -> "Redifine hotkeys (Keyboard remapping)" - selct Alt + A and assign em_setcurrenttime to this selection.

EDIT
Saw Gral' answer after posting mine - notice that my solution executes the change automatically due to the = after OPENATTRIBUTES
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7012
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Set Selected file to Current Date with AutoHotkey

Post by *Horst.Epp »

petermad wrote: 2022-02-19, 18:29 UTC EDIT
Saw Gral' answer after posting mine - notice that my solution executes the change automatically due to the = after OPENATTRIBUTES
Gral's solution does the same.
Look at the param==
Windows 11 Home, Version 24H2 (OS Build 26100.4351)
TC 11.55 RC7 x64 / x86
Everything 1.5.0.1395a (x64), Everything Toolbar 1.5.5.0, Listary Pro 6.3.2.88
QAP 11.9.0.4 x64
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Re: Set Selected file to Current Date with AutoHotkey

Post by *Gral »

Horst.Epp wrote: 2022-02-19, 18:41 UTC
petermad wrote: 2022-02-19, 18:29 UTC EDIT
Saw Gral' answer after posting mine - notice that my solution executes the change automatically due to the = after OPENATTRIBUTES
Gral's solution does the same.
Look at the param==
Exactly!
User avatar
petermad
Power Member
Power Member
Posts: 16116
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Set Selected file to Current Date with AutoHotkey

Post by *petermad »

Gral's solution does the same.
Look at the param==
Oops :oops: - sorry, I overlooked the double == (I always put the = directly after the command name in the cmd line, so that is why I didn't notice it in the param line)
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
jinsight
Senior Member
Senior Member
Posts: 299
Joined: 2003-02-25, 19:47 UTC
Location: Wooster, Ohio, USA

Re: Set Selected file to Current Date with AutoHotkey

Post by *jinsight »

2Gral, petermad and Horst.Epp

Thank you one and all for the speedy help. I would like to think I could/should have figured it out for myself. I'm glad you folks were present to, in fact, figure it out!
License #1945
Windows 10 Pro x64
Version 22H2 (OS Build 19045.3930)
TC 11.00 x64 and x86, Everything 1.5.0.1366a x64, QAP 11.6.3.1 x64
Post Reply