views:

59

answers:

2

Does such a thing exist where you can set up automatic text insertion shortcuts, but they can be dynamic?

A lot of work I'm doing involves a lot of changes to code, and I've found that I'm copy-pasting my MOD-string hundreds of times, and it can get lost in the other copy-paste objects.

Basically, I want to know if there's something I can setup where I can click say CTRL-ALT-M and it will automatically enter in

--MODYYMMDDBLT

where YY = year (2 digits), MM = month (2 digits), DD = day (see the trend?) and BLT is a userdefined string (namely, the developers initials)

I know that I've probably spent more time typing this than it does just typing '--MOD090701BLT', but I was wondering if such a thing existed.

It can't be program specific, because I'm flicking between things all the time.

If I can find something like it, then it can be used for different things, like say selecting a text string and wrapping a 'if exists (select blah from stuff where 'TEXT STRING' roar)' etc.

+1  A: 

Seriously, you add a comment like that to anything you change? Are you using source control? Is this for work where such a comment is mandated by some coding standard?

To answer your question, I would suppose that the macro facilities available in pretty much any full-featured text editor would provide such a capability. What are you using?

(Oh, and considering your nickname, your initials should totally be BLT. Just saying.)

Greg Hewgill
I use a combination of Notepad++, Notepad (MS standard) and SQL Programmer mostly, hence why I was hoping for a general XP program. We have source control, and we also use a '--MOD' system. Usually the system is '--MODYYMMDDABC What was changed, why, etc'. For my own work, I prefer to 'MOD' comment as I go before submitting things to sourcecontrol, so I don't lose what I've changed from the standard. It's more of a reminder of what I've done (eg I can see in my own copy of work what I did on Monday by looking up MOD090629ABC)
glasnt
+1 This is what version control is for. I strongly urge you to reconsider (i.e. scrap) this MOD system.
John Kugelman
Such a system would be nice for other things, not just MOD comments. Such as bulk text things 'Hi (CUSTOMER) We have logged your issue as (ISSUE) (PROFORMA TEXT HERE)'. Also, @GregHewgill, you have me wanting bacon. Damn you.
glasnt
@John Kugelman, what if you need to debug a script on a client site where you don't have access to your source control and you need to see what changes have been made recently?
ninesided
+1  A: 

I guess there are two approaches to take here, macros at the text editor level (most decent text editors support the notion of macros, but some are better than others) and then macros at the OS-level. Either way, if you can write a chunk of code in your language of choice that outputs the text that you want, you should be able to hook it up to key-stroke. My personal preference would be to use a text editor that supports this kind of thing out-of-the-box, so to speak, like JEdit or E-Text Editor. If you want to go down the OS-level route, you could investigate something like AutoHotkey.

ninesided
Horray! I can use AutoHotKey to add a custom hotkey Ctrl-Alt-M to add a mod comment (for those playing at home, it's " ^!m:: / Send {TAB}--MOD%A_YYYY%%A_MM%%A_DD%BLT / return " where '/' is a new line character (code takes up 3 lines). Thanks ninesided :D
glasnt