Getting Tool Parameters

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
textpadfan
Posts: 2
Joined: Fri Apr 09, 2004 6:45 pm

Getting Tool Parameters

Post by textpadfan »

For a custom Tool I wrote, I'd like to:

(1) Use the selected text as the parameter (using $Sel).
OR
(2) Prompt the user for the value if nothing is selected (using $Prompt).

Is there a way to define a Tool Parameter to be something like:

if ($Sel == null) then $Prompt(Enter value:) else $Sel
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post by CyberSlug »

You need to use a scripting language such as AutoIt v3 to do that. Here's one way:

Command: AutoIt3.exe foo.au3
Parameters: $Sel
Initial Folder: $FileDir

Code: Select all

;Contents of foo.au3
; Only run your tool if $SEL or the text the user provides is not null
$text = $CmdLine[1]
$text = "" Then $text = InputBox("Title", "Enter value:)
If $text <> "" Then Run("C:\somePath\yourTool.exe")
Post Reply