StrataFrame Forum

Inserting datetime via snippet for custom comment block

http://forum.strataframe.net/Topic15691.aspx

By Charles R Hankey - 4/16/2008

I would like to create a snippet to insert a custom comment block with my initials (which I want to make a task list token) and the datetime when i call the snippet

'CRH: <datetime>

' -- < my comments will go here >

I thought I was getting the hang of the snippet editor but can't seem to find the magic words to get it to insert the current date and time when it intellisenses the snippet. 

I have a macro that does it, which I dragged onto the tools menu and as a 'button' on the standard toolbar (that was an accident) and that works but I'd like to know how to have a snippet insert datetime.now or datetimenow.tolongstring() or whatever

Second part of question : for some reason today I can't create a new Task List Token.  The ADD choice is greyed out.  Thought it was working before.  Any idea what I could have done to break it?

TIA

Charles 

By Charles R Hankey - 4/16/2008

Okay, figured out the add a token part.  You have to type in the name of the token first, then the ADD button activates. 

For lurkers not familiar with this cool tip: 

If you create a token for the task list

you can then put (your own initials Smile )

'CRH:

in a comment and all such references will be listed with jump to links in the task list

( now if I could just figure out how to get the snippet that inserts it when I type crh TAB to put in the current date time as well ... )

By Greg McGuffey - 4/16/2008

I think the Function element is what you want.



http://msdn2.microsoft.com/en-us/library/ms171427.aspx



You'd define an object or literal, then add the function tag, with the function you'd like to run...I think.
By Charles R Hankey - 4/16/2008

Thanks Greg - I looked at that but it seems to only be for C# and also there are only three functions.

I guess the literals just don't resolve when you intellisense them in.  I have worked around it using macros which are also kind of fun

I'll post back here if I ever figure out an intellisense version ...

By Greg McGuffey - 4/16/2008

Ah, so it seems. I don't see any way to do this either.



You could use CodeSmith ($). They have a VS snippet like feature, only you can program what the snippet does.