How to create a command to insert Date, current File Name or Registry key?

Started by alex, April 17, 2009, 04:29:05 PM

Previous topic - Next topic

alex

Till now there is no macro support in HippoEDIT but there are Code templates ;)

If you need to insert current date in the document or current file name or Registry value you can use Code Templates.

Create and Code Template or for some specific syntax or for Default syntax (to have template available every where), assign to it name and Shorcut, enter text you want with any built-in tag and ... it works.

For example, you would like to insert current date when you edit text document:

  • Open Code Templates setting for Plain Text
  • Add...
  • Key = date, Description = Current Date, Shortcut = Ctrl + Shift + D
  • Ok
  • Enter such code for new template: Today %Date%
  • Ok
  • Now try to press Ctrl+Shift+D somewhere inside of text documen
  • Result: Today 04/17/09
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

Neat! Thank you.

Arthur

Besides, there is no way of extracting code templates for text documents, thus the above is not possible for text files, but why not?

alex

Could not get you Arthur...

Why you can as extract as use templates in text files.
To extract use menu Format -> Extract Template...
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

I have Extract Template disabled in text files, is that not normal?

alex

HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

rickprez

Looks like we are limited to the old "DOS" formats for %DATE% and %DateTime% from our user environment [correct or direct me if I am wrong, please]. Not as flexible in formatting your "Insert Date/Time" menu option, but this works for now.

Thanks for figuring it out Alex.

Rick

alex

Yes. There are not so much settings as in Insert Date/Time.
But you can use also %Day%, %Month% and %Year% to form presentation you like. Yes this is still limited, and you could not use verbal representation, but a little bit more freedom.

And I would think about adding commands for inserting date time. The problem there, that number of formats (and so items) are not limited (it can be changed in xml file). So I could not predict how many commands I need for this...
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]