hi!
it would be very helpful if it is possible to add parameters to a procedure in
the addMenuItem-function.
this example read's a directory and creates menu-items.
when you click on an item the file is appended.
example:
Set fso = CreateObject("Scripting.FileSystemObject")
Const module_name = "dev" 'this name must be unique !!!
Const module_ver = "1.0" 'version
Sub Init
menuName = "&" & module_name
arrTemp = ListFiles("directory")
For i = 0 to UBound(arrTemp) - 1
strFile = mid(arrTemp(i), instrrev(arrTemp(i),"\")+1)
addMenuItem strFile, menuName, _"appendFile(""" & strFile &
""")"_
Next
End Sub
Sub appendFile(strFile)
Set editor = newEditor()
editor.assignActiveEditor
echo strFile
editor.appendText ReadFile(strFile)
End Sub
Function ReadFile(rfDatei)
If fso.FileExists(rfDatei) Then
Set f2 = fso.GetFile(rfDatei)
If f2.Size > 0 Then
Set f = fso.OpenTextFile(rfDatei, 1)
ReadFile = f.ReadAll
f.Close
End If
Set f2 = nothing
End If
End Function
Function ListFiles(strPath)
Set folder = fso.GetFolder(strPath)
For each item in folder.Files
strOut = strOut & Item.Path & vbcrlf
Next
ListFiles = split(strOut, vbcrlf)
End Function
--
<http://forum.pspad.com/read.php?4,42907,42907>
PSPad freeware editor http://www.pspad.com