In FindAndRunRobot version
2.234.01 mouser added a useful alias command called
appcapresultsappcapresults runs an external program, waits for it to output to
stdout and then display that output (if correctly formatted) as FARR results lines.
This post shows examples on how to use it together with AutoHotkey to generate a results list in FARR.
; example AutoHotkey script for use with FARR appcapresults
; prepare a results list
; each line adheres to FARR's format for lines in alias results
; note: must have a blank line at the end, otherwise the last text line won't show in FARR
Results =
(
Notepad | C:\Windows\System32\notepad.exe
Paint | C:\Windows\System32\mspaint.exe
)
; use fileappend with * to write the list to stdout
1. Save the above script as C:\folder\example.ahk and compile to C:\folder\example.exe
2. Next create a FARR alias
alias name: appcapresults example
alias regex: ^appcap$
alias results:example | appcapresults C:\folder\example.exe
After that you can type "appcap" in FARR and press enter to get something like this
To make the alias trigger automatically, without Enter, you can change the alias to
example | dolaunch appcapresults C:\folder\example.exe
That's the basics. But this opens up the possibility of complex, conditional aliases. Some possibilities:
- Have the script present different results lists based on the current day/time
- Pass the %lasthwnd% parameter from FARR to the script and have script present different results depending on what window was active before FARR. For example we could make the alias "help" and have it show our own customized help hints based on what application is active.
Related earlier post.
- Another example is to have the script search Everything via its SDK and display the search results in FARR, in effect creating an alternative Everything plugin for FARR. This works, though I don't have the code cleaned up enough to post it yet.
edit:
More complex example: alias results conditional on the active window
; complex example conditional AutoHotkey script for use with FARR appcapresults
; window id for active window as parameter sent from FARR
LastHwnd := A_Args[1]
; if active window is Firefox
If LastHwnd
and WinExist("ahk_exe Firefox.exe ahk_id " LastHwnd
) {
Results =
(LTrim
Google | https://www.google.com/
Wiki | https://en.wikipedia.org/
)
}
; if active window is MS Paint
If LastHwnd
and WinExist("ahk_exe mspaint.exe ahk_id " LastHwnd
) {
Results =
(LTrim
// use FARR sendkeys command to
send action shortcuts to MS Paint
Resize | sendkeys ^w
Crop selection | sendkeys ^(+x)
)
}
; use fileappend with * to write the list to stdout
1. Save the above script as C:\folder\example2.ahk and compile to C:\folder\example2.exe
2. Next create/edit a FARR alias
alias name: appcapresults example2
alias regex: ^appcap$
alias results:example | appcapresults C:\folder\example2.exe %lasthwnd%
Type "appcap" and press enter over MS Paint and Firefox to get different results
example/howto: alias appcapresults command with AutoHotkeyexample/howto: alias appcapresults command with AutoHotkeyGIF of sending the action shortcuts to MS Paint from FARR
https://i.imgur.com/0SE2wDQ.mp4edit2: improved complex example