ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Find And Run Robot

alias with parameter

(1/1)

goddert:
Hi,

I did configure a simple alias which takes a parameter to launch a script


--- ---alias trigger: proxy

Regular Expression pattern: ^proxy (.*)$

Script:
cntlm | c:\bin\proxy-set.bat "$$1"
ccproxy | c:\bin\proxy-set.bat "$$1"
off | c:\bin\proxy-set.bat "$$1"
Using the alias with a parameter works fine. Instead when I use the cursor to choose manually one of the three options (cntlm, ccproxy, off) how do I pass my choice to the script proxy-set? Preferably as string (cntlm, ccproxy, off).

I did search but couldn't find the right topic. Or maybe I did use the wrong search strings.

Thanks in advance for any help.

Goddert

wjamoe:
This should work:

alias trigger: proxy
Regular Expression pattern: ^proxy\s+(.+)$

Script:
proxy cntlm | c:\bin\proxy-set.bat "cntlm"
proxy ccproxy | c:\bin\proxy-set.bat "ccproxy"
proxy off | c:\bin\proxy-set.bat "off"
proxy $$1 | c:\bin\proxy-set.bat "$$1"

Each line includes a fixed parameter on the right side.

I modified the regex, the parameter is now optional.

The last line is optional, it will allow you to specify a different proxy parameter to the bat file.
For readability I added 'proxy' at the start of each line, this is not mandatory.
but for the last line it is kind of essential, it would otherwise only show your typed parameter in the search result list (depending on your farr display options/report columns).

goddert:
Thank you very much!

Your solution works fine ... partly  :)
Choosing with the cursor obviously FARR takes the selected option and launches the script with the corresponding parameter.

Instead if I write the parameter in the FARR window FARR doesn't pass the written parameter to the script but FARR takes always the first of the options. In my case the option with cntlm. E.g., I write "proxy foo" nevertheless FARR executes the line c:\bin\proxy-set.bat "cntlm".

I have to investigate why (btw FARR shows the parameter as I'm writing it but for a reason unknown chooses the first line)

Anyway thanks again.

Goddert

wjamoe:
it looks like either

the farr option ' stop at first exact match' is enabled in options search behaviour.

or you enabled 'always launch first result on hitting enter' within keyboard interface

I won't be able to reproduce all the possible combinations of farr settings, so here you are on your own.

if it always takes the first line, you could try moving my last line to the top line

(are you sure you disabled all other aliases matching 'proxy' ?)

Navigation

[0] Message Index

Go to full version