I'm writing a code documenting automation routine & I need a routine that
will take a highlighted block of code or text and prefix each line with a
short character string of my choosing ... like the Comment/Uncomment options
on the Format context menu. I've tried a macro using ctrl-x, alines() &
keyboarding the prefixed lines back into the code, but I can't get it to
work reliably. Other suggestions?
TIA

-Lew

Re: Comment macro or Intellisense script by Bernhard

Bernhard
Tue Oct 24 11:47:05 CDT 2006

Hi Lew,

> I'm writing a code documenting automation routine & I need a routine that
> will take a highlighted block of code or text and prefix each line with a
> short character string of my choosing ... like the Comment/Uncomment options
> on the Format context menu. I've tried a macro using ctrl-x, alines() &
> keyboarding the prefixed lines back into the code, but I can't get it to
> work reliably. Other suggestions?
Instead of KEYBOARDing the resulting lines, maybe you fill the result in
_CLIPTEXT and KEYBOARD only some CTRL+V

A quite differenc approach: use the functions of foxtools.fll. But this needs
some trying and testing.

Regards
Bernhard Sander

Re: Comment macro or Intellisense script by Lew

Lew
Tue Oct 24 12:45:28 CDT 2006

Yep, tried that too: keyboard out, ctrl-v out. Didn't like it. I'll look
into foxtools, but the only thing of interest I see there are the clipboard
functions which I have access to through vfp's _CLIPTEXT already. Any other
ideas?
-Lew

"Bernhard Sander" <fuchs@no.spam> wrote in message
news:eEzCNw49GHA.4524@TK2MSFTNGP04.phx.gbl...
> Hi Lew,
>
>> I'm writing a code documenting automation routine & I need a routine that
>> will take a highlighted block of code or text and prefix each line with a
>> short character string of my choosing ... like the Comment/Uncomment
>> options on the Format context menu. I've tried a macro using ctrl-x,
>> alines() & keyboarding the prefixed lines back into the code, but I can't
>> get it to work reliably. Other suggestions?
> Instead of KEYBOARDing the resulting lines, maybe you fill the result in
> _CLIPTEXT and KEYBOARD only some CTRL+V
>
> A quite differenc approach: use the functions of foxtools.fll. But this
> needs some trying and testing.
>
> Regards
> Bernhard Sander



Re: Comment macro or Intellisense script by Bernhard

Bernhard
Tue Oct 24 13:30:35 CDT 2006

Hi Lew,

> I'll look
> into foxtools, but the only thing of interest I see there are the clipboard
> functions which I have access to through vfp's _CLIPTEXT already.
There are quite a lot of other functions in foxtools.fll which are not
documented by Microsoft. There is a special help file ToolHelp.hlp available at
universal thread. Look for Download ID 9333.

Regards
Bernhard Sander

Re: Comment macro or Intellisense script by Lew

Lew
Tue Oct 24 14:01:01 CDT 2006

Awesome! Way to go George Tasker. _EdInsert() looks like it'll fit the bill.
Thanks, Bernhard.

-Lew

"Bernhard Sander" <fuchs@no.spam> wrote in message
news:%23sjZDq59GHA.4388@TK2MSFTNGP02.phx.gbl...
> Hi Lew,
>
>> I'll look into foxtools, but the only thing of interest I see there are
>> the clipboard functions which I have access to through vfp's _CLIPTEXT
>> already.
> There are quite a lot of other functions in foxtools.fll which are not
> documented by Microsoft. There is a special help file ToolHelp.hlp
> available at universal thread. Look for Download ID 9333.
>
> Regards
> Bernhard Sander



Re: Comment macro or Intellisense script by Lew

Lew
Tue Oct 24 14:48:46 CDT 2006

Even better, it works. A a code example for anyone who's following this
thread follows. Make sure the edit window is the active window when you make
this call, eg through an okl.
Thanks again Bernhard and George.

-Lew

function ed_WriteComments
lparameters cPrefix
local nWindow, aText[1], nLine, cOut
set library to "foxtools.fll" additive
nWindow = _WOnTop()
cOut = ""
if _EdCut(nWindow)
for nLine = 1 TO alines(aText, _CLIPTEXT)
cOut = cOut + cPrefix + aText[nLine] + CHR(13)+CHR(10)
next
_EdInsert(nWindow, cOut, LEN(cOut))
endif
return


"Bernhard Sander" <fuchs@no.spam> wrote in message
news:%23sjZDq59GHA.4388@TK2MSFTNGP02.phx.gbl...
> Hi Lew,
>
>> I'll look into foxtools, but the only thing of interest I see there are
>> the clipboard functions which I have access to through vfp's _CLIPTEXT
>> already.
> There are quite a lot of other functions in foxtools.fll which are not
> documented by Microsoft. There is a special help file ToolHelp.hlp
> available at universal thread. Look for Download ID 9333.
>
> Regards
> Bernhard Sander



Re: Comment macro or Intellisense script by Olaf

Olaf
Wed Oct 25 02:51:57 CDT 2006

Hi Lew,

that's nice.

The perhaps most famous use of that _Ed...-
functions is through ISX.prg by Christof Wollen-
haupt, which introduced Intellisense vor variable
names and constants before VFP had intellisense
for commands and is about the functionallity of
VFP9 with typing ZLOC and ZDEF within
methods or programs at a key stroke of CTRL+I.

If you want to play around more with these "hidden"
foxtools.fll functions take a look at isx.prg, you can
get that from http://www.foxpert.com/downloads.htm
=> http://www.foxpert.com/download/isx.PRG

Besides that, there's also an option for defining the
prefix of each line caused by commenting a code
block. It's Tools->Options->Editor->Comment
String, default is the well known *!*

The only disadvantage is, if you don't want a
* as first character of that option, you'd need to
delete that afterwards, as that is added automa-
tically, if the comment string does not start with *.

Bye, Olaf.



Re: Comment macro or Intellisense script by Lew

Lew
Wed Oct 25 08:47:51 CDT 2006

That's a very interesting site. I wonder if Christof has documented
objref.fll anywhere.

-Lew
"Olaf Doschke" <b2xhZi5kb3NjaGtlQHNldG1pY3MuZGU@strconv.14.de> wrote in
message news:Oa4cnrA%23GHA.4464@TK2MSFTNGP02.phx.gbl...
> Hi Lew,
>
> that's nice.
>
> The perhaps most famous use of that _Ed...-
> functions is through ISX.prg by Christof Wollen-
> haupt, which introduced Intellisense vor variable
> names and constants before VFP had intellisense
> for commands and is about the functionallity of
> VFP9 with typing ZLOC and ZDEF within
> methods or programs at a key stroke of CTRL+I.
>
> If you want to play around more with these "hidden"
> foxtools.fll functions take a look at isx.prg, you can
> get that from http://www.foxpert.com/downloads.htm
> => http://www.foxpert.com/download/isx.PRG
>
> Besides that, there's also an option for defining the
> prefix of each line caused by commenting a code
> block. It's Tools->Options->Editor->Comment
> String, default is the well known *!*
>
> The only disadvantage is, if you don't want a
> * as first character of that option, you'd need to
> delete that afterwards, as that is added automa-
> tically, if the comment string does not start with *.
>
> Bye, Olaf.
>
>



Re: Comment macro or Intellisense script by Olaf

Olaf
Wed Oct 25 09:46:28 CDT 2006

> That's a very interesting site. I wonder if Christof has documented
> objref.fll anywhere.

SET LIBRARY TO some.fll
DISPLAY STATUS
=> lists the loaded functions of the fll...

In Objref.fll both functions need an object
passed in as parameter, I think.

Bye, Olaf.