nisus.com
https://www.nisus.com/forum/

Cool clipboard macro for selecting text from a clipboard
https://www.nisus.com/forum/viewtopic.php?f=17&t=4483
Page 1 of 1

Author:  loulesko [ 2011-09-05 14:54:17 ]
Post subject:  Cool clipboard macro for selecting text from a clipboard

I have been looking for a way to make the fabulous multiple clipboards more useful and I think I hit on something good. This macro lists the first 60 characters from each clipboard in a list and then allows you to click on multiple choices to paste them in your document. If you don't want to paste jus hit ESC key.

Code:
# Clipboards
$n = 1
$count = Clipboard Count
$choicelist = “”
While $n <= $count
   $clipboardName = $n
   $clipboardData = Read Clipboard $clipboardName
   $len = $clipboardData.length
If $len > 60
$range = Range.new(0, 60)
else
$range = Range.new(0, $len)
End
If $clipboardData
$clipboardData = $clipboardData.subtextInRange($range)
# Strip out the line feeds so the text looks good in the prompt window.
$map = Hash.new
$map{0x00A} = ‘ ’
$range = Range.new(0, $clipboardData.length)
$clipboardData.transliterateInRange($range, $map)
End
If $len > 60
$clipboardData = “$n)  $clipboardData...($len)”
else
$clipboardData = “$n)  $clipboardData”
End
# If the choice list exists append to array else create new array
If !$choicelist
$choicelist = Array.new($clipboardData)
else
$choicelist.appendValue($clipboardData)
End
   $n += 1
End
$choice = Prompt Checkboxes ‘Clipboards’,‘’, 'Paste', $choicelist
# Find the location of the first close paren which indicates the end of the clipboard number.
ForEach $cbname in $choice
$range = $cbname.rangeOfString “)”
$range = $range.location
$range = Range.new(0, $range)
$cbname = $cbname.subtextInRange($range)
$clipboardData = Read Clipboard $cbname
If $clipboardData
Type Text “$clipboardData ”
End
End


Author:  martin [ 2011-09-06 15:22:40 ]
Post subject:  Re: Cool clipboard macro for selecting text from a clipboard

Thanks for sharing Lou, this seems pretty handy!

Author:  loulesko [ 2011-09-06 15:28:39 ]
Post subject:  Re: Cool clipboard macro for selecting text from a clipboard

Thanks Martin - it is shockingly useful.

L

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/