Re: Copy contents of code/editor window with formatting

2022-02-06 Thread AndyHC

I don't know about automating it but this seems to work in the edit window:
Ctl_A  Ctl_C  -> in e.g. Word - Ctl_V  - save as  type .rtf


On 07-Feb-22 5:19 AM, paul.newton.h...@gmail.com wrote:

Hi all

  


I am trying to copy the contents of the editing window that is currently
active (i.e. that I am editing) as text with its RTF formatting code.  What
I have got (cribbed) so far is this:

  


SET LIBRARY TO (HOME()+"Foxtools.FLL")

nWHAND =_EDOPENFIL("TEST.PRG", 1)

nEDstart = _EDSKIPLIN(m.nWHAND,0,0)

nEDend   = _EDSKIPLIN(m.nWHAND,0,10)

= _EDSELECT(m.nWHAND, m.nEDstart, m.nEDend)

= _EDCOPY(m.nWHAND)

= _EDCLOSEFI(m.nWHAND, 0)

  


This works fine insofar as I can paste the code into Word and see that the
code highlighting is correct.  But there are a couple of issues I haven't
yet been able to resolve:

  


1.  I want it to work with the current/open editing window
2.  I want to work with the underlying RTF, i.e. the text together with
the RTF formatting tags

  


I expect to invoke the code to do this via a hotkey so that the window that
I am working on will be the active window.  Any help or suggestions would be
much appreciated.  Many thanks.

  


Paul Newton



--- StripMime Report -- processed MIME parts ---
multipart/alternative
   text/plain (text body -- kept)
   text/html
---


[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/f9cecd43-9f87-5212-e075-3cabf12e9...@hawthorncottage.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Re: Copy contents of code/editor window with formatting

2022-02-06 Thread Christof Wollenhaupt
Hi Paul,

> 1.I want it to work with the current/open editing window

in ISX I use the following code:

*-
* Get the current window and verify that it is a valid window.
*-
Local lnWHandle
lnWHandle = GetCurrentWindow()
If lnWHandle == 0
If not Empty(m.tcInvocation)
Clear TypeAhead
Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
Endif
Return
Endif

*-
* Verify that the current window is indeed an edit window.
*-
Local lnEditSource 
lnEditSource = GetEditSource(m.lnWHandle)
If not InList( m.lnEditSource, 1, 8, 10, 12 )
If not Empty(m.tcInvocation)
Clear TypeAhead
Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
Endif
Return
EndIf

*
* Determines the source of the window identified by the passed 
* WHandle. It returns the following values:
*
* -1 The window is not an edit window
*  0 Command Window
*  1 MODIFY COMMAND window
*  2 MODIFY FILE window
*  8 Menu Designer code window
* 10 Method Edit Window in Class or Form Designer
* 12 MODIFY PROCEDURE window
*
* This procedure uses _EdGetEnv() from the FoxTools.Fll to determine
* the edit source. Passing an invalid handle causes an exception in
* VFP 5 and VFP 3. In VFP 6 this raises an error 2028 (API function
* caused an exception). Therefore we return -1 in this case, too.
*
Procedure GetEditSource
LParameter tnWHandle

Local laEnv[25], lnSource, lnOK, lcError
lcError = On( "Error" )
On Error lnOK = 0
lnOK = _EdGetEnv( m.tnWHandle, @laEnv )
On Error 
If m.lnOK == 0
lnSource = -1
Else
lnSource = laEnv[25]
Endif

Return m.lnSource


*
* Returns the WHandle of the current edit window or 0, if no edit
* window is available.
*
Procedure GetCurrentWindow

Local lnWindowOnTop
lnWindowOnTop = _WOnTop()
If m.lnWindowOnTop <= 0
Return 0
Endif
If GetEditSource( m.lnWindowOnTop ) == -1
lnWindowOnTop = 0
Endif

Return m.lnWindowOnTop


-- 
Christof



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/edcf902b-5506-4043-a70b-6ef032e3d...@wollenhaupt.org
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Copy contents of code/editor window with formatting

2022-02-06 Thread paul.newton.hudl
Hi all

 

I am trying to copy the contents of the editing window that is currently
active (i.e. that I am editing) as text with its RTF formatting code.  What
I have got (cribbed) so far is this:

 

SET LIBRARY TO (HOME()+"Foxtools.FLL")

nWHAND =_EDOPENFIL("TEST.PRG", 1)

nEDstart = _EDSKIPLIN(m.nWHAND,0,0)

nEDend   = _EDSKIPLIN(m.nWHAND,0,10)

= _EDSELECT(m.nWHAND, m.nEDstart, m.nEDend)

= _EDCOPY(m.nWHAND)

= _EDCLOSEFI(m.nWHAND, 0)

 

This works fine insofar as I can paste the code into Word and see that the
code highlighting is correct.  But there are a couple of issues I haven't
yet been able to resolve:

 

1.  I want it to work with the current/open editing window
2.  I want to work with the underlying RTF, i.e. the text together with
the RTF formatting tags

 

I expect to invoke the code to do this via a hotkey so that the window that
I am working on will be the active window.  Any help or suggestions would be
much appreciated.  Many thanks.

 

Paul Newton



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/004401d81bb4$2317b890$694729b0$@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.