custom tool - Passing selected text to/from ext tools
Posted: Wed Jul 22, 2009 4:32 pm
2009-07-22 Wed
I have been using EditPad Pro 5.x (JG Soft) for many years and developed a number of my own custom tools for it in the form of vbscripts. My workplace however uses TextPad (vrsn 5.2.0) and I would like to set it up to work with some of my scripts. In EditPad you can set up a tool to save the selected text to a temp file then run your script, passing it the temp filename as a command line argument. The script then reads in the file, manipulates the text however you want, and saves it back to the buffer. EditPad then reads the temp file and replaces the selected text with the output of the tool (script). The effect is seamless from the editor.
How would I accomplish the same thing in TextPad? If possible I would like to set the tool up in the same way so both the TextPad and EditPad versions of the tools use the same scripts, so I don't have to maintain multiple versions. However I am not seeing the same I/O options - the closest thing I see for passing a multiline selection to a tool is via the clipboard ($Clip). I tried setting up a tool to copy the selected text to the clipboard this way, then call a "script proxy" (VB EXE I built, as vbscripts can't access the clipboard or some reason I can't currently recall) that receives the vbscript name, saves the clipboard to a temp file, invokes the vbscript, sending it the temp filename as a command line parameter, lets the script finish then reads the script output back from the file & copies it back to the clipboard for TextPad to replace the selected text with, but when I run the external tool, the vb proxy throws an error "Run-time error '5': Invalid procedure call or argument". I seem to have hit a wall with this error currently, and am just wondering if there is an easier way to call my existing vbscripts from TextPad (else I'll just keep plugging on...)   Â
Any help appreciated...
Â
I have been using EditPad Pro 5.x (JG Soft) for many years and developed a number of my own custom tools for it in the form of vbscripts. My workplace however uses TextPad (vrsn 5.2.0) and I would like to set it up to work with some of my scripts. In EditPad you can set up a tool to save the selected text to a temp file then run your script, passing it the temp filename as a command line argument. The script then reads in the file, manipulates the text however you want, and saves it back to the buffer. EditPad then reads the temp file and replaces the selected text with the output of the tool (script). The effect is seamless from the editor.
How would I accomplish the same thing in TextPad? If possible I would like to set the tool up in the same way so both the TextPad and EditPad versions of the tools use the same scripts, so I don't have to maintain multiple versions. However I am not seeing the same I/O options - the closest thing I see for passing a multiline selection to a tool is via the clipboard ($Clip). I tried setting up a tool to copy the selected text to the clipboard this way, then call a "script proxy" (VB EXE I built, as vbscripts can't access the clipboard or some reason I can't currently recall) that receives the vbscript name, saves the clipboard to a temp file, invokes the vbscript, sending it the temp filename as a command line parameter, lets the script finish then reads the script output back from the file & copies it back to the clipboard for TextPad to replace the selected text with, but when I run the external tool, the vb proxy throws an error "Run-time error '5': Invalid procedure call or argument". I seem to have hit a wall with this error currently, and am just wondering if there is an easier way to call my existing vbscripts from TextPad (else I'll just keep plugging on...)   Â
Any help appreciated...
Â