Const module_name  = "someName"   'this name must be unique !!!
Const module_ver   = "0.001a"     'version of your script
'==============================================================
' name "Init" is required, its called automatically 
' during initialization to create menu items
Sub Init
'addMenuItem "Menu item", "Sub menu if wanted", "Name of Function to Call"
 addMenuItem "Click me to start the script", "Sub menu 1", "DoIt"
End Sub
'==================================================

Sub DoIt               
Set editor = newEditor()  'new editor object              
    editor.assignActiveEditor() 'work with active document
vText = editor.selText() 'put selected text in variable vText

' here do something with this selected text
' e.g. splitt selected text into lines
vArrayLines = Split(vText, vbCrlf)

' or ask something the user 
vUserInput = InputBox("Input the value...", "My Title","1")
MsgBox "You entered: " & vUserInput,16,"Hello"
 
' collect all lines together
For i = 0 To UBound(vArrayLines)
 If Not i = UBound(vArrayLines) Then
  vStringList = vStringList & vArrayLines(i) & vbCrLf
 Else
  vStringList = vStringList & vArrayLines(i)
 End If
Next

'put the text back to the active document
editor.selText vStringList

Set editor = Nothing
End Sub 'DoIt
'====================================================
'<EOF>================================================


Just search the forum for scripts and learn from it.

Script Language Reference ==> http://gogogadgetscott.info/pspad/functions.htm
Macro commands ==> http://gogogadgetscott.info/pspad/macroprikaz.htm
PSPad Scripts ==> http://www.pspad.com/de/pspad-extensions.php

-- 
<http://forum.pspad.com/read.php?2,42293,42298>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem