Author Topic: How to create a command to insert Date, current File Name or Registry key?  (Read 3928 times)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
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

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Neat! Thank you.
« Last Edit: April 17, 2009, 10:46:41 PM by Arthur »

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
Besides, there is no way of extracting code templates for text documents, thus the above is not possible for text files, but why not?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
Could not get you Arthur...

Why you can as extract as use templates in text files.
To extract use menu Format -> Extract Template...

Offline Arthur

  • Registered User
  • Hero Member
  • *
  • Posts: 653
  • Karma: +1/-0
  • He who is ashamed of asking is afraid of learning.
    • My Blog
I have Extract Template disabled in text files, is that not normal?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
You have to select some text first ;)

Offline rickprez

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Works but limited?
« Reply #6 on: April 20, 2009, 03:26:49 PM »
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

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
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...