Main Menu

How to add new file template

Started by alex, January 04, 2012, 06:51:10 PM

Previous topic - Next topic

alex

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).

[attachimg=1]

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.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

swu

could you let me now if this feature is working?  I have build 149.829, when I select "Manage File Templates" but nothing shows.

alex

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.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

swu

hi, it seems to me that the feature doesn't work on Vista.  I tested on XP and it works.

alex

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?
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

swu

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.

alex

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
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

swu

#7
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.

Stefan

Quote from: swu on January 24, 2012, 05:47:56 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?
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

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.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

swu

#10
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.

alex

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.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]