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?

Entry

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

Nov 16th, 2006 15:47
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 17 November 2020 - 00:20 am -------------------
TSE: Clipboard: Named: TSE: Operation: Paste: How to paste from a 
named clipboard using a list?
===
Idea:
By design, each named clipboard is stored in a buffer in TSE.
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 FNClipboardGetBufferNamedSimpleI( STRING s1 )
FORWARD INTEGER PROC FNClipboardGotoBufferNamedSimpleB( STRING s1 )
FORWARD PROC Main()
FORWARD PROC PROCClipboardInsertPasteNamedLetter( STRING s1 )
FORWARD PROC PROCClipboardInsertPasteNamedLetterListSimple( STRING s1, 
STRING s2 )
FORWARD STRING PROC FNClipboardGetNamedLetterListSimpleS( STRING s1, 
STRING s2 )
FORWARD STRING PROC FNStringGetClipboardBufferNamedFilenameSimpleS( 
STRING s1 )
FORWARD STRING PROC FNStringGetLineFileBeginClipboardNamedS( STRING 
s1 )
// --- MAIN --- //
PROC Main()
 PROCClipboardInsertPasteNamedLetterListSimple( "A", "Z" )
END
<F12> Main()
// --- LIBRARY --- //
// library: clipboard: insert: paste: named: letter: list: simple 
(filenamemacro=inseclls.s) [kn, ri, th, 16-11-2020 23:44:21]
PROC PROCClipboardInsertPasteNamedLetterListSimple( STRING 
letterBeginS, STRING letterEndS )
 // e.g. PROC Main()
 // e.g.  PROCClipboardInsertPasteNamedLetterListSimple( "A", "Z" )
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 STRING s[255] = ""
 PushPosition()
 s = FNClipboardGetNamedLetterListSimpleS( letterBeginS, letterEndS )
 PROCClipboardInsertPasteNamedLetter( s )
 PopPosition()
END
// library: clipboard: get: buffer: named: letter: list: simple 
(filenamemacro=getcllsk.s) [kn, ri, th, 16-11-2020 23:19:05]
STRING PROC FNClipboardGetNamedLetterListSimpleS( 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 + " " + FNStringGetLineFileBeginClipboardNamedS( 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: paste: named: letter 
(filenamemacro=inseclnl.s) [kn, ri, th, 16-11-2020 23:45:08]
PROC PROCClipboardInsertPasteNamedLetter( STRING s )
 // e.g. PROC Main()
 // e.g.  PROCClipboardInsertPasteNamedLetter( "A" )
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 INTEGER bufferIdI = 0
 PushPosition()
 bufferIdI = FNClipboardGotoBufferNamedSimpleB( 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 the used 
by TSE itself as it main Copy() and Paste() buffer. In that case do 
thus nothing, and leave it as is
 IF NOT ( Lower( s ) == "a" )
  MarkLine( 1, NumLines() )
  Copy()
 ENDIF
 PopPosition()
 Paste()
END
// library: string: get: block: change: wrap: line1: clipboard: named 
(filenamemacro=getstcnd.s) [kn, ri, th, 16-11-2020 22:01:53]
STRING PROC FNStringGetLineFileBeginClipboardNamedS( 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 = FNClipboardGotoBufferNamedSimpleB( letterClipboardS )
 IF ( bufferIdI == 0 )
  s = ""
 ELSE
  BegFile()
  s = GetText( 1, 255 )
 ENDIF
 PopPosition()
 PopBlock()
 RETURN( s )
END
// library: clipboard: goto: buffer: named: simple 
(filenamemacro=gotoclns.s) [kn, ri, mo, 13-11-2020 00:47:47]
INTEGER PROC FNClipboardGotoBufferNamedSimpleB( STRING s )
 // e.g. PROC Main()
 // e.g.  Message( FNClipboardGotoBufferNamedSimpleB( "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 = FNClipboardGetBufferNamedSimpleI( s )
 RETURN( GotoBufferId( bufferId ) )
END
// library: clipboard: get: buffer: named: simple 
(filenamemacro=getclnsi.s) [kn, ri, su, 12-11-2020 22:47:34]
INTEGER PROC FNClipboardGetBufferNamedSimpleI( STRING s )
 // e.g. PROC Main()
 // e.g.  Message( FNClipboardGetBufferNamedSimpleI( "A" ) ) // gives 
e.g. 29
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 STRING clipBoardNameS[255] = 
FNStringGetClipboardBufferNamedFilenameSimpleS( s )
 INTEGER bufferId = GetBufferId( clipBoardNameS )
 RETURN( bufferId )
END
// library: string: get: clipboard: buffer: named: filename: simple 
(filenamemacro=getstfsi.s) [kn, ri, su, 12-11-2020 22:49:22]
STRING PROC FNStringGetClipboardBufferNamedFilenameSimpleS( STRING s )
 // e.g. PROC Main()
 // e.g.  Message( FNStringGetClipboardBufferNamedFilenameSimpleS
( "A" ) ) // gives e.g. "+++A"
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 RETURN( "+++" + s )
END
--- cut here: end ----------------------------------------------------
===
Internet: see also:
---
TSE: Clipboard: Named: Link: Overview: Can you give an overview of 
links?
http://www.faqts.com/knowledge_base/view.phtml/aid/42993/fid/899
----------------------------------------------------------------------