Author Topic: How to add new file template  (Read 4857 times)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
How to add new file template
« on: January 04, 2012, 06:51:10 pm »
File templates are files with default pattern content used to "pre-fill" newly created documents.

Selection of file template is done based on extension of new document and name of template: editor searches for file with same extension and name "default" in directory of file templates.
To find directory where file templates are located select File->New->Manage File Templates (usually %HippoEDIT user directory%\templates).



All file templates (files) with name different from default added to menu of File->New->%Syntax% as not auto templates and can be selected manually.
default templates used automatically if document with such extension created, with shortcut for example. To skip template pattern, you can keep Ctrl kept, when creating of the new file from within the menu.

It is allowed to use code templates in file templates - file template text is pre-processed, and all code templates are expanded.

Offline swu

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: How to add new file template
« Reply #1 on: January 21, 2012, 03:32:49 am »
could you let me now if this feature is working?  I have build 149.829, when I select "Manage File Templates" but nothing shows.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to add new file template
« Reply #2 on: January 21, 2012, 06:11:04 am »
Hi swu,

yes, it should work. I have retested. The result should be Windows Explorer window open for file templates directory.
Something like this: C:\Users\%USER%\AppData\Roaming\HippoEDIT\data\templates

BR, Alex.

Offline swu

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: How to add new file template
« Reply #3 on: January 21, 2012, 06:53:12 pm »
hi, it seems to me that the feature doesn't work on Vista.  I tested on XP and it works.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to add new file template
« Reply #4 on: January 21, 2012, 07:53:43 pm »
I have tested on Win 7. There are not too much to be broken. This is a ShellExecute with path to folder.
Maybe folder does not exist? Where are your settings stored?

Offline swu

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: How to add new file template
« Reply #5 on: January 24, 2012, 02:03:47 am »
the directory exists for me but still the FileExplorer doesn't pop up on Vista.  Does HE relies on %userprofile% variable?  Is my environment varialbe setting expected to work?

USERNAME=swu
USERPROFILE=C:\Users\swu.SYBASE

BTW, I saw the timestamps in the template are dated May/16 last year.  Since then util now I have updated HT several times.

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to add new file template
« Reply #6 on: January 24, 2012, 03:15:53 am »
Templates are not updated very often, and installer, I think skip overwrite, if file is not newer.

No, HE does not rely on %userprofile%, it relies on value from hippoedit.config:
<TemplatesDirectory>.\\templates\\</TemplatesDirectory>

path is relative to user directory (from HE understanding).

Maybe TemplatesDirectory is corrupted?

BR, Alex

Offline swu

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: How to add new file template
« Reply #7 on: January 24, 2012, 05:47:56 am »
I've attached my config file, from what I can tell there is no <TemplatesDirectory> inside it for some reason.

Still, it is interesting to note that on XP the config file looks the same, it doesn't have that entry either but works.
« Last Edit: January 24, 2012, 05:52:10 am by swu »

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: How to add new file template
« Reply #8 on: January 24, 2012, 11:44:24 am »
from what I can tell there is no <TemplatesDirectory> inside it for some reason.
I think this is due the fact the defaults are not stored to config file. (I have not such entry too in my config)
Only if you use other values then factory default, then this is written to the config.
(but i don't know if is anyhow possible to relocate the templates folder?)

I use HippoEDIT 1.49.822 as portable on XP and
"File->New->Manage File Templates" works for me,
WinEx opens with "D:\rive\pathTo\HippoEDIT\data\templates"
(i can test on W7 too if needed)


Quote from: swu
the directory exists for me but still the FileExplorer doesn't pop up on Vista.
Can you post this path?
You can find the current ussed path to the "data" folder in "Help > About"
The "templates" folder is by default an sub-folder of "data".

Do you have 32- or 64-bit?
Do you have UAC enabled?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to add new file template
« Reply #9 on: January 24, 2012, 04:30:44 pm »
Thanks Stefan,

yes, our are right about default parameters. If TemplatesDirectory node does not exist, it should be equal to user directory path + \templates\.

What I can assume, that this is some how connected to UAC, and if there was portable installation selected and user files were installed inside of Program Files folder (together with templates directory), maybe ShellExecute will not open it, because of the permissions...

So, swu, tell us what you see in About Settings path or in Tools->Options->General->Settings Path.

Offline swu

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: How to add new file template
« Reply #10 on: January 28, 2012, 05:56:53 am »
it is a Vista machine and the path is:
C:\Users\swu.SYBASE\AppData\Roaming\HippoEDIT\

when I created "templates" folder then this action works.  So it is kind of a bug in HippoEDIT I assume.
« Last Edit: January 28, 2012, 05:59:56 am by swu »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2172
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: How to add new file template
« Reply #11 on: February 06, 2012, 04:08:03 am »
No, problem. If the only a reason for the problem missing templates folder, I can easy fix this. In next 1.50 update.
And for 1.49 the workaround will be to create the "templates" folder manually.

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
1380 Views
Last post April 20, 2009, 10:53:50 pm
by alex
4 Replies
3058 Views
Last post April 29, 2009, 05:16:54 pm
by Arthur
1 Replies
2578 Views
Last post September 27, 2009, 07:47:24 pm
by Stefan
1 Replies
1881 Views
Last post September 10, 2010, 01:25:50 am
by alex
1 Replies
394 Views
Last post March 19, 2017, 04:15:48 pm
by alex