I have uploaded this script to the extension download page:
'*******************************************************************************
' FILENAME : multiple_paste.vbs
' DESCRIPTION : This script will paste the selected text block a given
' number of times, each time on a new line and replace any
' insertion markers in the text with either an incrementing
' number or a value from a comma delimited list.
' If no text is selected the user will be prompted to enter
' text into an input box.
' If there is no insertion marker in the selected/entered
' text block and the user enters a number when prompted for
' the replacement input, then the textblock will be pasted
' the given number of times with no changes made to the
text.
' USAGE : For example if you select or enter the following text:
' (NOTE: the insertion marker can be changed from the
default of § on LINE 66)
' [list § "example_§"] \
' You will then be prompted to enter the range of values
' with which to replace the insertion marker(s). The script
' accepts 3 different formats of replacement input:
' An End Number for Incremental Replacement (0 to n),
' (NOTE: the incremental start index can be changed from the
default of 0 on LINE 67)
' Eg. entering 3 returns:
' [list 0 "example_0"] \
' [list 1 "example_1"] \
' [list 2 "example_2"] \
' [list 3 "example_3"] \
' A Numeric Range, Eg. entering 5-9 returns:
' [list 5 "example_5"] \
' [list 6 "example_6"] \
' [list 7 "example_7"] \
' [list 8 "example_8"] \
' [list 9 "example_9"] \
' A Comma Delimited List, Eg. entering red,blue,green
returns:
' [list red "example_red"] \
' [list blue "example_blue"] \
' [list green "example_green"] \
' CREATED : 8 October 2007
' CREATED BY : James Swan
' NOTE : Configure the preferred insertion marker on LINE 66
' Configure the preferred incremental start index on LINE
67
' This script has only been tested on Windows XP
' You may distribute this script freely, but please keep this header intact.
'*******************************************************************************
Option Explicit
Const MODULE_NAME = "MultiplePaste"
Const MODULE_VER = "0.1"
Const MODULE_TITLE = "Multiple Paste"
'**************************** CONFIGURE
************************************
Const INSERTION_MARKER = "§"
Const INCREMENTAL_START_INDEX = 0
'***************************************************************************
Dim strInput, strOutput
Sub Init()
addMenuItem MODULE_TITLE, "Utilities", MODULE_NAME, "CTRL+SHIFT+ALT+V"
End Sub
Sub MultiplePaste ()
Dim objEditor
' empty any content from any previous multiple pastes
strInput = ""
strOutput = ""
Set objEditor = newEditor()
With objEditor
.assignActiveEditor()
strInput = .selText()
If ProcessInput() Then
' trim trailing line break
strOutput = Left(strOutput,Len(strOutput)-1)
.selText strOutput
End If
End With
Set objEditor = nothing
End Sub
Function ProcessInput()
Dim strInsert
Dim i, intStart, intEnd, intTotal
Dim arrInserts
If Len(strInput) = 0 Then
strInput = InputBox("Please enter the text to paste" & vbCrLf &
"including insertion marker(s): " & INSERTION_MARKER & "" & vbTab, MODULE_TITLE,
"")
End If
If Len(strInput) = 0 Then
Call AbortAlert("You must enter some text to paste.", False)
ProcessInput = False
Exit Function
Else
If InStr(strInput, INSERTION_MARKER) > 0 Then
strInsert = Trim(InputBox("Please enter the range of values with
which to replace the insertion marker(s)." & vbCrLf & "This can be in any one of
the following formats: " & vbCrLf & vbCrLf &_
"- Number" & vbTab & vbTab & "eg 10." & vbCrLf &_
"- Numeric Range" & vbTab & "eg 5-10." & vbCrLf &_
"- Comma Delimited List" & vbTab & "eg red,blue,green." & vbTab
& vbCrLf _
, MODULE_TITLE))
If Len(strInsert) = 0 Then
Call AbortAlert("You must enter either a number, a numeric
range, or a comma delimited list.", True)
ProcessInput = False
Exit Function
Else
If InStr(strInsert,",") > 0 Then
arrInserts = Split(strInsert, ",")
ElseIf InStr(strInsert,"-") > 0 Then
intStart = Int(Left(strInsert, InStr(strInsert,"-")-1))
intEnd = Int(Mid(strInsert, InStr(strInsert,"-")+1))
intTotal = intEnd - intStart
If intEnd < intStart Then
Call AbortAlert("When entering a numeric range, the
last value must be greater than the first.", False)
ProcessInput = False
Exit Function
End If
ReDim arrInserts(intTotal)
For i = 0 To UBound(arrInserts)
arrInserts(i) = intStart + i
Next
ElseIf IsNumeric(strInsert) Then
intStart = INCREMENTAL_START_INDEX
intEnd = Int(strInsert)
intTotal = intEnd - intStart
If intEnd < intStart Then
Call AbortAlert("You entered a value [" & intEnd &
"] less than your currently entered incremental start index [" &
INCREMENTAL_START_INDEX & "].", False)
ProcessInput = False
Exit Function
End If
ReDim arrInserts(intTotal)
For i = 0 To UBound(arrInserts)
arrInserts(i) = intStart + i
Next
Else
Call AbortAlert("I'm sorry, but an unanticipated error
occurred.", False)
ProcessInput = False
Exit Function
End If
For i = 0 To UBound(arrInserts)
strOutput = strOutput & Replace(strInput,
INSERTION_MARKER, arrInserts(i)) & vbCrLf
Next
End If
Else
strInsert = Trim(InputBox("Please enter the number of times you
wish to paste the text." & vbTab & vbCrLf, MODULE_TITLE))
If IsNumeric(strInsert) Then
For i = 0 To strInsert
strOutput = strOutput & strInput & vbCrLf
Next
Else
Call AbortAlert("You may only enter a number if the text to
be pasted contains no insertion marker(s).", True)
ProcessInput = False
Exit Function
End If
End If
ProcessInput = True
End If
End Function
Sub AbortAlert(strMsg, blnShowPleaseSee)
If blnShowPleaseSee Then
strMsg = strMsg & vbTab & vbCrLf & "Please see the header of the
script source for more information on using " & MODULE_TITLE & "."
End If
MsgBox "Aborting..." & vbCrLf & vbCrLf & strMsg & vbTab & vbCrLf, 16,
MODULE_TITLE
End Sub
--
<http://forum.pspad.com/read.php?2,42625,42697>
PSPad freeware editor http://www.pspad.com