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

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


----------------------------------------------------------------------
--- Knud van Eeden --- 26 November 2020 - 03:49 am -------------------
TSE: Clipboard: Named: Windows: Operation: Copy: How to copy to 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 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 FNClipboardCreateWClipboardNamedI( STRING s1 )
FORWARD INTEGER PROC FNClipboardGetWBufferNamedSimpleI( STRING s1 )
FORWARD INTEGER PROC FNClipboardGotoWBufferNamedSimpleB( STRING s1 )
FORWARD PROC Main()
FORWARD PROC PROCClipboardInsertCopyWNamedLetterListSimple( STRING s1, 
STRING s2 )
FORWARD PROC PROCClipboardInsertWCopyNamedLetter( STRING s1 )
FORWARD STRING PROC FNClipboardGetWNamedLetterListSimpleS( STRING s1, 
STRING s2 )
FORWARD STRING PROC FNStringGetWClipboardBufferNamedFilenameSimpleS( 
STRING s1 )
FORWARD STRING PROC FNStringGetWLineFileBeginClipboardNamedS( STRING 
s1 )
// --- MAIN --- //
PROC Main()
 PROCClipboardInsertCopyWNamedLetterListSimple( "A", "Z" )
END
<F12> Main()
// --- LIBRARY --- //
// library: clipboard: insert: copy: w: named: letter: list: simple 
(filenamemacro=insecllv.s) [kn, ri, su, 26-11-2020 02:39:52]
PROC PROCClipboardInsertCopyWNamedLetterListSimple( STRING 
letterBeginS, STRING letterEndS )
 // e.g. PROC Main()
 // e.g.  PROCClipboardInsertCopyWNamedLetterListSimple( "A", "Z" )
 // e.g. END
 // e.g.
 // e.g. <F12> Main()
 STRING s[255] = ""
 PushPosition()
 PushBlock()
 CopyToWinClip()
 s = FNClipboardGetWNamedLetterListSimpleS( letterBeginS, letterEndS )
 PROCClipboardInsertWCopyNamedLetter( s )
 PopBlock()
 UnMarkBlock()
 PopPosition()
END
// library: clipboard: get: w: named: letter: list: simple 
(filenamemacro=getcllsj.s) [kn, ri, su, 26-11-2020 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: copy: named: letter 
(filenamemacro=inseclnn.s) [kn, ri, su, 26-11-2020 02:48:38]
PROC PROCClipboardInsertWCopyNamedLetter( STRING s )
 // e.g. PROC Main()
 // e.g.  PROCClipboardInsertWCopyNamedLetter( "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 )
  bufferIdI = FNClipboardCreateWClipboardNamedI( s )
  GotoBufferId( bufferIdI )
 ENDIF
 MarkLine( 1, NumLines() )
 KillBlock()
 PasteFromWinClip()
 PopPosition()
END
// library: string: get: w: line: file: begin: clipboard: named 
(filenamemacro=getstcnf.s) [kn, ri, su, 26-11-2020 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-2020 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: create: w: clipboard: named 
(filenamemacro=creaclcn.s) [kn, ri, su, 26-11-2020 02:48:03]
INTEGER PROC FNClipboardCreateWClipboardNamedI( STRING s )
 // e.g. PROC Main()
 // e.g.  Message( FNClipboardCreateWClipboardNamedI( "B" ) ) // gives 
e.g. 3
 // 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
 // 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
 IF ( bufferIdI == 0 )
  bufferIdI = CreateBuffer( 
FNStringGetWClipboardBufferNamedFilenameSimpleS( s ), _HIDDEN_ )
 ENDIF
 PopPosition()
 RETURN( bufferIdI )
END
// library: clipboard: get: w: buffer: named: simple 
(filenamemacro=getclnsj.s) [kn, ri, su, 26-11-2020 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-2020 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
----------------------------------------------------------------------