Here is an simple script.
This works for one problem only: text number text number text
For all other situations the script have to be modified
that is to say the hole algorithm have to be improved.
 
Also for leading zeros the script have to be improved.

' VB Script Document  ' http://forum.pspad.com/  ' Posted by: Stefan |
Date: 05.Oct.2007  
Const MODULE_NAME = "StS07InsertTEXTWithNUMBERS"  'this name must be unique !!!
Const MODULE_VER = "0.1"
Const MODULE_TITLE = "Insert Text with numbers"    'as displayed in PSPad menu
Const MsgTitle = "Insert Text with numbers"
Sub Init
    addMenuItem "Insert Text with numbers",  MODULE_TITLE,
"InsertTextWithNumbers"
    addMenuItem "&Open this script file to edit",  MODULE_TITLE,
"openThisScriptFile"
End Sub
'====================================================================='
' This script ask for an line of text with numbers
' and increas this number how often you want
' and paste this into the document 


Sub InsertTextWithNumbers()
Dim editor, mySign, myText, myAmount, myNewText, Output
    Set editor = newEditor()
    editor.assignActiveEditor



mySign = InputBox("Enter an sign as place holder where you want to insert a
number: " ,MsgTitle, "#")
If mySign = Cancel Then Exit Sub

myText  = InputBox("Enter an text and use your sign " & mySign & " as place
holder where you want to insert a number: " ,MsgTitle, "")
If myText = Cancel Then Exit Sub

myAmount  = InputBox("How many " & vbCR & myText & vbCR & vbCR & " lines do you
want?: " ,MsgTitle, "")
If myAmount = Cancel Then Exit Sub

myText = Split(myText, mySign)

For Num = 1 To myAmount
myNewText = myText(0) & Num & myText(1) & Num & myText(2)
            If Num <  myAmount  Then
               Output = Output & myNewText & vbCrlf
            Else
               Output = Output & myNewText
            End If
Next
    
    editor.selText Output
End Sub
'=============================================================='

'###############################################################################
###################'
Sub openThisScriptFile
    Set obj1 = newEditor()
    obj1.openFile(moduleFileName(module_name))
End Sub


.

.

.

-- 
greets,     Stefan
[img]http://pspad.milten.lima-city.de/Fan.gif[/img]  (pleased user since 1722)
[url=http://tinyurl.com/52xrj]inofficial FAQs[/url] +  
[url=http://forum.pspad.com/read.php?2,16286,page=2]Infos[/url] + 
[url=http://forum.pspad.com/read.php?6,24628]Special Settings[/url]

<http://forum.pspad.com/read.php?2,42625,42634>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem