Reply to topic  [ 3 posts ] 
Cool clipboard macro for selecting text from a clipboard 
Author Message
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
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



2011-09-05 14:54:17
Profile WWW
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Thanks for sharing Lou, this seems pretty handy!


2011-09-06 15:22:40
Profile WWW
User avatar

Joined: 2008-01-20 11:08:35
Posts: 89
Location: California
Thanks Martin - it is shockingly useful.

L


2011-09-06 15:28:39
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software