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

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2183
  • Karma: +37/-3
    • View Profile
    • 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.
    • View Profile
    • My Blog
Neat! Thank you.
« Last Edit: April 17, 2009, 09: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.
    • View Profile
    • 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: 2183
  • Karma: +37/-3
    • View Profile
    • 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.
    • View Profile
    • My Blog
I have Extract Template disabled in text files, is that not normal?

Offline alex

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

Offline rickprez

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Works but limited?
« Reply #6 on: April 20, 2009, 02: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: 2183
  • Karma: +37/-3
    • View Profile
    • 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...

 

Related Topics

  Subject / Started by Replies Last post
11 Replies
3089 Views
Last post March 08, 2009, 12:13:15 am
by Stefan
0 Replies
2317 Views
Last post March 07, 2009, 08:51:51 pm
by Stefan
2 Replies
1473 Views
Last post April 15, 2009, 03:26:19 am
by Arthur
9 Replies
2495 Views
Last post May 10, 2010, 02:12:46 pm
by alex
1 Replies
2311 Views
Last post April 29, 2011, 01:49:27 pm
by alex