Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Comment with Date

Status
Not open for further replies.

albertdc

Programmer
Feb 10, 2004
38
0
0
PH
Currently, I have a SHIFT+CTRL+D macro assigned for this in default.fky with the ff. "&&{SPACEBAR}MyName{SPACEBAR}<<DATE>>". However, I'd like to expand "<<DATE>>" to the actual date. How can this be done in VFP6?

Thanks!
 

AlbertDC,

You can't do that with a keyboard macro. Keyboard macros only play back keystrokes. They can't evaluate expressions.

One solution would be to write a small program (one line) that copies the date to the clipboard:

Code:
* CopyDate.Prg
_CLIPTEXT = DATE()

Link that program to a keystroke via ON KEY LABEL (do this in the command window at the start of the session):

Code:
ON KEY LABEL CTRL+F2 DO CopyDate

Finally, write a keyboard macro that inserts your name, types Ctrl+F2, then does a CTRL+V to copy from the clipboard.

Another possibility: Use the free Clipomatic tool that I mentioned in thread184-1081856. This lets you set up a permanent "clipboard item" that contains your name and today's date, in any format you like. To insert the clipboard item, just hit Ctrl+Alt+V and select it from the popup menu.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks for your reply, Mike.

I did a little tinkering and came up with this:

Code:
[COLOR=#00008B]DEFINE BAR[/color] [RED]5018[/RED] [COLOR=#00008B]OF _MTOOLS ;
	PROMPT[/color] [COLOR=#FF00FF]"\<Developer's Comment"[/color] ;
	[COLOR=#00008B]AFTER _MTL_OPTNS ;
	KEY ALT+D
ON SELECTION BAR[/color] [RED]5018[/RED] [COLOR=#00008B]OF _MTOOLS ;
	DO[/color] [MAROON]InsertProgsComment[/MAROON] [COLOR=#00008B]IN HOME()[/color] + [COLOR=#FF00FF]"vfpstart.prg"[/color]

Code:
[COLOR=green]*********************************************************
* InsertProgsComment
*********************************************************[/color]
[COLOR=darkblue]PROCEDURE[/color] [maroon]InsertProgsComment[/maroon]
	[COLOR=darkblue]LOCAL[/color] [maroon]lcOnError[/maroon][blue],[/blue] [maroon]lnError[/maroon][blue],[/blue] [maroon]lnWHandle[/maroon]
	
	[COLOR=darkblue]If[/color] [blue]not[/blue] [COLOR=fuchsia]"FOXTOOLS.FLL"[/color] [blue]$[/blue] [COLOR=darkblue]Upper[/color][blue]([/blue][COLOR=darkblue]Set[/color][blue]([/blue][COLOR=fuchsia]"Library"[/color][blue]))[/blue]
		[COLOR=darkblue]Set Library to[/color] [blue]([/blue][COLOR=darkblue]Home[/color][blue]()+[/blue][COLOR=fuchsia]"FoxTools.Fll"[/color][blue])[/blue] [COLOR=darkblue]Additive
	Endif[/color]
	
	[maroon]lcOnError[/maroon] [blue]=[/blue] [COLOR=darkblue]ON[/color][blue]([/blue][COLOR=fuchsia]'ERROR'[/color][blue])[/blue]
	[COLOR=darkblue]ON ERROR[/color] [maroon]lnError[/maroon] [blue]=[/blue] [COLOR=darkblue]ERROR[/color][blue]()[/blue]
	
	[maroon]lnWHandle[/maroon] [blue]=[/blue] [maroon]_WOnTop[/maroon][blue]()[/blue]
	[COLOR=darkblue]IF[/color] [maroon]lnWHandle[/maroon] [blue]>[/blue] [red]0[/red]
		[COLOR=darkblue]LOCAL[/color] [maroon]lcComment
		
		lcComment[/maroon] [blue]=[/blue] [COLOR=fuchsia]'&'[/color] [blue]+[/blue] [COLOR=fuchsia]'& '[/color] [blue]+[/blue] [COLOR=darkblue]GETENV[/color][blue]([/blue][COLOR=fuchsia]'LOGIN_NAME'[/color][blue]) +[/blue] [COLOR=fuchsia]' '[/color] [blue]+[/blue] [COLOR=darkblue]DTOC[/color][blue]([/blue][COLOR=darkblue]DATE[/color][blue]()) +[/blue] [COLOR=fuchsia]': '[/color]
		
		[maroon]_EdInsert[/maroon][blue]([/blue] [maroon]lnWHandle[/maroon][blue],[/blue] [maroon]lcComment[/maroon][blue],[/blue] [COLOR=darkblue]Len[/color]([maroon]lcComment[/maroon][blue]) )[/blue]
	[COLOR=darkblue]ENDIF
	
	ON ERROR[/color] [blue]&[/blue][maroon]lcOnError[/maroon]

[COLOR=darkblue]ENDPROC[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top