Inserting datetime via snippet for custom comment block


Author
Message
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
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 

Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
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 ...

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search