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
Getting Tool Parameters
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
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
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")