faqts : Computers : Programming : Languages : Tse : Clipboard

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

TSE: Clipboard: Named: Windows: Operation: Paste: How to paste from a named clipboard using a list?

Nov 25th, 2006 18:58
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 26 November 2006 - 03:55 am -------------------

TSE: Clipboard: Named: Windows: Operation: Paste: How to paste from a 
named clipboard using a list?

===

Idea:

Each named Windows clipboard is stored in a buffer.

The name of that buffer is

 ++++< letter of your named clipboard >

e.g.

++++A is the buffername for named clipboard A

++++B is the buffername for named clipboard B
...
++++Z is the buffername for named clipboard Z

You go then trough all the named clipboards from A to Z and do 
something
with the text in the corresponding buffer (e.g. copy to or paste from)

===

Usage:

The content of the named clipboard which you choose from the list is
pasted at your current cursor position
(e.g. if you choose "B" from the list, then the content of that named
clipboard "B" is copied at your current cursor position)

===

--- cut here: begin --------------------------------------------------

FORWARD INTEGER PROC FNClipboardGetWBufferNamedSimpleI( STRING s1 )

FORWARD INTEGER PROC FNClipboardGotoWBufferNamedSimpleB( STRING s1 )

FORWARD PROC Main()

FORWARD PROC PROCClipboardInsertWPasteNamedLetter( STRING s1 )

FORWARD PROC PROCClipboardInsertWPasteNamedLetterListSimple( STRING 
s1, STRING s2 )

FORWARD STRING PROC FNClipboardGetWNamedLetterListSimpleS( STRING s1, 
STRING s2 )

FORWARD STRING PROC FNStringGetWClipboardBufferNamedFilenameSimpleS( 
STRING s1 )

FORWARD STRING PROC FNStringGetWLineFileBeginClipboardNamedS( STRING 
s1 )

// --- MAIN --- //

PROC Main()

 PROCClipboardInsertWPasteNamedLetterListSimple( "A", "Z" )

END

<F12> Main()

// --- LIBRARY --- //

// library: clipboard: insert: w: paste: named: letter: list: simple 
(filenamemacro=insecllw.s) [kn, ri, su, 26-11-2006 02:56:36]

PROC PROCClipboardInsertWPasteNamedLetterListSimple( STRING 
letterBeginS, STRING letterEndS )

 // e.g. PROC Main()

 // e.g.  PROCClipboardInsertWPasteNamedLetterListSimple( "A", "Z" )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 STRING s[255] = ""

 PushPosition()

 s = FNClipboardGetWNamedLetterListSimpleS( letterBeginS, letterEndS )

 PROCClipboardInsertWPasteNamedLetter( s )

 PopPosition()

END

// library: clipboard: get: w: named: letter: list: simple 
(filenamemacro=getcllsj.s) [kn, ri, su, 26-11-2006 02:41:07]

STRING PROC FNClipboardGetWNamedLetterListSimpleS( STRING 
letterBeginS, STRING letterEndS )

 // e.g. PROC Main()

 // e.g.  Message( FNClipboardGetNamedLetterListSimpleS
( "A", "Z" ) ) // returns letter of named clipboard you choose from 
list with content of all named clipboards

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 STRING s[255] = ""

 STRING resultS[255] = ""

 STRING clipboardS[255] = ""

 INTEGER bufferResultIdI = CreateTempBuffer()

 INTEGER minI = ASC( letterBeginS )

 INTEGER maxI = ASC( letterEndS )

 INTEGER I = minI - 1

 INTEGER stopB = FALSE

 INTEGER maxB = FALSE

 REPEAT

  I = I + 1

  s = CHR( I )

  maxB = ( I >= maxI )

  clipboardS = s + " " + FNStringGetWLineFileBeginClipboardNamedS( s )

  AddLine( clipboardS, bufferResultIdI )

  stopB = maxB

 UNTIL ( stopB )

 GotoBufferId( bufferResultIdI )

 IF ( List( "Clipboard: Name: Overview", 100 ) <> 0 )

  resultS = GetText( 1, 1 )

 ENDIF

 AbandonFile( bufferResultIdI )

 RETURN( resultS )

END

// library: clipboard: insert: w: paste: named: letter 
(filenamemacro=inseclnp.s) [kn, ri, su, 26-11-2006 02:50:43]

PROC PROCClipboardInsertWPasteNamedLetter( STRING s )

 // e.g. PROC Main()

 // e.g.  PROCClipboardInsertWPasteNamedLetter( "A" )

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 INTEGER bufferIdI = 0

 PushPosition()

 bufferIdI = FNClipboardGotoWBufferNamedSimpleB( s )

 bufferIdI = bufferIdI // to avoid warning that it is not used when 
compiling

 IF ( bufferIdI == 0 )

  RETURN()

 ENDIF

 // You should not include the "A" named clipboard, because this is 
used by TSE itself as it main Copy() and Paste() buffer. In that case 
do thus nothing, and leave it as is

 MarkLine( 1, NumLines() )

 CopyToWinClip()

 PopPosition()

 PasteFromWinClip()

END

// library: string: get: w: line: file: begin: clipboard: named 
(filenamemacro=getstcnf.s) [kn, ri, su, 26-11-2006 02:41:35]

STRING PROC FNStringGetWLineFileBeginClipboardNamedS( STRING 
letterClipboardS )

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetLineFileBeginClipboardNamedS( "A" ) ) // 
gives e.g. the content of named clipboard "A", get first line, and 
return this line in a string

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 INTEGER bufferIdI = 0

 STRING s[255] = ""

 PushPosition()

 PushBlock()

 bufferIdI = FNClipboardGotoWBufferNamedSimpleB( letterClipboardS )

 IF ( bufferIdI == 0 )

  s = ""

 ELSE

  BegFile()

  s = GetText( 1, 255 )

 ENDIF

 PopPosition()

 PopBlock()

 RETURN( s )

END

// library: clipboard: goto: w: buffer: named: simple 
(filenamemacro=gotoclnt.s) [kn, ri, su, 26-11-2006 02:42:07]

INTEGER PROC FNClipboardGotoWBufferNamedSimpleB( STRING s )

 // e.g. PROC Main()

 // e.g.  Message( FNClipboardGotoWBufferNamedSimpleB( "A" ) ) // give 
TRUE if going to the buffer of that named clipboard was successful

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 INTEGER bufferId = FNClipboardGetWBufferNamedSimpleI( s )

 RETURN( GotoBufferId( bufferId ) )

END

// library: clipboard: get: w: buffer: named: simple 
(filenamemacro=getclnsj.s) [kn, ri, su, 26-11-2006 02:42:38]

INTEGER PROC FNClipboardGetWBufferNamedSimpleI( STRING s )

 // e.g. PROC Main()

 // e.g.  Message( FNClipboardGetWBufferNamedSimpleI( "A" ) ) // gives 
e.g. 29

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 STRING clipBoardNameS[255] = 
FNStringGetWClipboardBufferNamedFilenameSimpleS( s )

 INTEGER bufferId = GetBufferId( clipBoardNameS )

 RETURN( bufferId )

END

// library: string: get: w: clipboard: buffer: named: filename: simple 
(filenamemacro=getstfsj.s) [kn, ri, su, 26-11-2006 02:43:08]

STRING PROC FNStringGetWClipboardBufferNamedFilenameSimpleS( STRING s )

 // e.g. PROC Main()

 // e.g.  Message( FNStringGetWClipboardBufferNamedFilenameSimpleS
( "A" ) ) // gives e.g. "++++A"

 // e.g. END

 // e.g.

 // e.g. <F12> Main()

 RETURN( "++++" + s )

END

--- cut here: end ----------------------------------------------------

===

Internet: see also:

---

windows: Clipboard: Named: Link: Overview: Can you give an overview of 
links?
http://www.faqts.com/knowledge_base/view.phtml/aid/42993/fid/899

----------------------------------------------------------------------