469,572 Members | 1,159 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Template Language: [!output .......]

Hello,

I want to add a date (ShortDateString) to a custom template-file (Class).
I use:

a.. [!output SAFE_NAMESPACE_NAME]
b.. [!output SAFE_CLASS_NAME]
c.. [!output SAFE_ITEM_NAME]
But I can't find anythig on a date (something like: [!output SHORTDATE_STRING])

TIA,

Michael
Nov 20 '05 #1
4 1206
Hi Michael,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to insert a shortdate
string into the template file.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think there is no such predefined symbol for shortdate string. We have to
do it ourself by add a symbol which represents the shortdate string into
the VCWizCtl Object.
For detailed information about the VCWizCtl Object, take a look at the
IVCWizCtrlUI interface.

We can use the AddSymbol Method of VCWizCtl Object to add the new added
symbol to the symbol table, so that when we render the Template file, the
symbols will be translated into the string it represent.

VCWizCtl Object
http://msdn.microsoft.com/library/de...us/vcext/html/
vxlrfVCWIZLibVCWizCtl.asp

Visual C++ Wizard Model
http://msdn.microsoft.com/library/de...us/vcext/html/
vcoriVisualCWizardModel.asp

The methods of the IVCWizCtrlUI.
http://msdn.microsoft.com/library/de...us/vcext/html/
vcoriVisualCWizardModel.asp

Here is some links about customized the Template.

Visual Studio Code Templates - Modifying Your Default Templates
http://dotnetjunkies.com/WebLog/bsbl...1/12/5519.aspx

Enterprise Templates: Building an Application Construction Kit in Visual
Studio .NET 2003
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vstchEnterpriseTemplatesBuildingApplicationConstru ctionKit.asp
e.g. we can change the template of console application.
usually the wizard for the console appliation is located in the path below.
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\

We need to change two file.
1. the js file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Scripts\1033 \default.js
Add the code below at the beginning of the OnFinish function in the file.
var date;
var dateString;
date = new Date();
dateString = (date.getMonth() + 1) + "/";
dateString += date.getDate() + "/";
dateString += date.getYear();
wizard.AddSymbol("CURRENT_DATE", dateString);

2. The template file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Templates\10 33\Module.vb
change the file as below.

Module [!output SAFE_ITEM_NAME]

Sub Main()
[!output CURRENT_DATE]
End Sub

End Module

After that if we create a new Console application, the module file in the
new added project will be below.
Module Module1

Sub Main()
4/15/2004
End Sub

End Module
[Note: My example is just for demo, I suggest you change according to your
request]
[And this will change the default behavor of VS.NET IDE and will easily
screw things up. So please DO make a backup before make any change to this
file.]

Please apply my suggestion above and let me know if it helps resolve your
problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
Thank you Peter, this is 100% what I needed
(....wizard.AddSymbol("CURRENT_DATE", dateString);).
(I already implemented it)

Kind regards,

Michael

""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:Qq**************@cpmsftngxa06.phx.gbl...
Hi Michael,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to insert a shortdate
string into the template file.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think there is no such predefined symbol for shortdate string. We have to do it ourself by add a symbol which represents the shortdate string into
the VCWizCtl Object.
For detailed information about the VCWizCtl Object, take a look at the
IVCWizCtrlUI interface.

We can use the AddSymbol Method of VCWizCtl Object to add the new added
symbol to the symbol table, so that when we render the Template file, the
symbols will be translated into the string it represent.

VCWizCtl Object
http://msdn.microsoft.com/library/de...us/vcext/html/ vxlrfVCWIZLibVCWizCtl.asp

Visual C++ Wizard Model
http://msdn.microsoft.com/library/de...us/vcext/html/ vcoriVisualCWizardModel.asp

The methods of the IVCWizCtrlUI.
http://msdn.microsoft.com/library/de...us/vcext/html/ vcoriVisualCWizardModel.asp

Here is some links about customized the Template.

Visual Studio Code Templates - Modifying Your Default Templates
http://dotnetjunkies.com/WebLog/bsbl...1/12/5519.aspx

Enterprise Templates: Building an Application Construction Kit in Visual
Studio .NET 2003
http://msdn.microsoft.com/library/de...us/dv_vstechar t/html/vstchEnterpriseTemplatesBuildingApplicationConstru ctionKit.asp
e.g. we can change the template of console application.
usually the wizard for the console appliation is located in the path below. C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\

We need to change two file.
1. the js file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Scripts\1033 \default.js
Add the code below at the beginning of the OnFinish function in the file.
var date;
var dateString;
date = new Date();
dateString = (date.getMonth() + 1) + "/";
dateString += date.getDate() + "/";
dateString += date.getYear();
wizard.AddSymbol("CURRENT_DATE", dateString);

2. The template file
C:\Program Files\Microsoft Visual Studio .NET
2003\Vb7\VBWizards\ConsoleApplication\Templates\10 33\Module.vb
change the file as below.

Module [!output SAFE_ITEM_NAME]

Sub Main()
[!output CURRENT_DATE]
End Sub

End Module

After that if we create a new Console application, the module file in the
new added project will be below.
Module Module1

Sub Main()
4/15/2004
End Sub

End Module
[Note: My example is just for demo, I suggest you change according to your
request]
[And this will change the default behavor of VS.NET IDE and will easily
screw things up. So please DO make a backup before make any change to this
file.]

Please apply my suggestion above and let me know if it helps resolve your
problem.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3
Hi Michael,

I am glad that my suggestion will help you.

Have a nice day!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
"Peter Huang" wrote:
Hi Michael,

I am glad that my suggestion will help you.

Have a nice day!


Peter, first, thanks. This is ridiculously more difficult than it should be,
and the links you gave are extremely helpful.

One note about issues like the custom date string and so on... this is one
of the things which is VERY useful about having a scripting language in
there. A string can be created using JScript's own Date() function and then
even formatted with a great deal of precision.
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Thomi Richards | last post: by
35 posts views Thread by Steven T. Hatton | last post: by
45 posts views Thread by charles.lobo | last post: by
9 posts views Thread by vilarneto | last post: by
9 posts views Thread by stephen.diverdi | last post: by
1 post views Thread by WebCM | last post: by
12 posts views Thread by nooneinparticular314159 | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.