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: Copy: How to copy to a named clipboard using a list?

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


----------------------------------------------------------------------
--- Knud van Eeden --- 17 November 2020 - 00:20 am -------------------
TSE: Clipboard: Named: TSE: Operation: Copy: How to copy to 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 highligted block in your current file is copied to the named 
clipboard
which you choose from the list (e.g. if you choose "B" from the list,
then the current block is copied to that named clipboard.
===
--- cut here: begin --------------------------------------------------
FORWARD INTEGER PROC FNClipboardCreateClipboardNamedI( STRING s1 )
FORWARD INTEGER PROC FNClipboardGetBufferNamedSimpleI( STRING s1 )
FORWARD INTEGER PROC FNClipboardGotoBufferNamedSimpleB( STRING s1 )
FORWARD PROC Main()
FORWARD PROC PROCClipboardInsertCopyNamedLetter( STRING s1 )
FORWARD PROC PROCClipboardInsertCopyNamedLetterListSimple( 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()
 PROCClipboardInsertCopyNamedLetterListSimple( "A", "Z" )
END
<F12> Main()
// --- LIBRARY --- //
// library: clipboard: insert: copy: named: letter: list: simple 
(filenamemacro=insecllu.s) [kn, ri, th, 16-11-2020 23:58:26]
PROC PROCClipboardInsertCopyNamedLetterListSimple( STRING 
letterBeginS, STRING letterEndS )
 // e.g. PROC Main()
 // e.g.  PROCClipboardInsertCopyNamedLetterListSimple( "A", "Z" )
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 STRING s[255] = ""
 PushPosition()
 PushBlock()
 Copy()
 s = FNClipboardGetNamedLetterListSimpleS( letterBeginS, letterEndS )
 PROCClipboardInsertCopyNamedLetter( s )
 PopBlock()
 UnMarkBlock()
 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: copy: named: letter 
(filenamemacro=inseclnm.s) [kn, ri, th, 16-11-2020 23:55:55]
PROC PROCClipboardInsertCopyNamedLetter( 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
 // 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" )
  IF ( bufferIdI == 0 )
   bufferIdI = FNClipboardCreateClipboardNamedI( s )
   GotoBufferId( bufferIdI )
  ENDIF
  MarkLine( 1, NumLines() )
  KillBlock()
  Paste()
 ENDIF
 PopPosition()
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: insert: copy: named: letter 
(filenamemacro=inseclnm.s) [kn, ri, th, 16-11-2020 23:55:55]
INTEGER PROC FNClipboardCreateClipboardNamedI( STRING s )
 // e.g. PROC Main()
 // e.g.  Message( FNClipboardCreateClipboardNamedI( "B" ) ) // gives 
e.g. 3
 // 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
 // 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" )
  IF ( bufferIdI == 0 )
   bufferIdI = CreateBuffer( 
FNStringGetClipboardBufferNamedFilenameSimpleS( s ), _HIDDEN_ )
  ENDIF
 ENDIF
 PopPosition()
 RETURN( bufferIdI )
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
----------------------------------------------------------------------