Author
Topic: Output to Farr's memo mode (Read 42373 times)

mouser, i have been working with a command-line program for which i've created an alias to input different parameters but i would like to capture the output as well and show it in Farr's memo. is it possible within the current alias setup?

you can't currently do it, BUTthere are 2 ways it could easily be supported.

1) someone could write a fairly simple plugin whose only purpose was to let users shell a command and capture the output to display in FARR memo mode. this would be a useful plugin and i've suggested it before.2) i could add a builtin special alias command for this, and/or for grabbing the output of a file and displaying it in FARR memo output.

Personally i'd love to see someone write a plugin for this. I'd be happy to help a plugin writer figure out how to use the special way of calling plugin dlls with arguments so they could be used most easily for this kind of purpose (basically farr lets you specify a dll in an alias as if you were invoking an exe, which is a good way to provide a plugin dll that others can use for these kinds of things).

Really there are 2 functions that would be useful to have in a plugin like this:1) to shell a command and capture the stdout console output to display in FARR memo.2) to shell a command and then grab the output from a file and display in FARR memo.

We have some excellent FARR plugin writers so i'll leave it to them to code this.. If no one does then I do think it's past time we had it so i'll try to add it eventually if no one else does.

The other nice thing about such a helper plugin is that it would then let you use any scripting language (e.g. autohotkey) to do operations that generate output to display, without even needing a plugin interface for them.

Here's another cool idea for such a plugin.Have a mode where the output of the commandline executed is not interpreted as Memo output, BUT is instead interpreted as a list of results(!) that would be displayed as normal FARR results. Again this would be a perfect way to interface other scripting languages in a non-realtime way that wouldnt require an api interface.

in the AHK forums, there is a DLL called CMDret, which does this but since this is a DLL, it's quite difficult for me for understand it fully so i'm trying out the AHK version. i'll post the results here if there is a positive one.

CMDret v3.x is a .DLL file (Freeware) that has been designed to return the output from a console program to a variable (rather than redirect to a textbox like the command line version). Version 3.1 (or greater) now includes a function that has the ability to output to a control and should be more stable than the command line version. Please keep in mind that CMDret is currently a beta realease. Any feedback would be greatly appreciated

i'm trying this out but i'm not sure how to pass the program path and its parameter. e.g. if the program is "C:\Tools\uptime.exe", how should i enter it in Farr's edit-line? also what is the use of double-ampersands (&&)?

great work, czechboy! this works quite well. i'm testing this with a tool called CityTime and here is the output. btw, the note about the "&&" is an important clue. next, i'll try to make this work with an alias.

after some tinkering, i've managed to get this working via alias and it get very interesting now as all cli tools that "displays info and exit" can now be routed this way in a nice Farr memo window. check out the screenshot and thanks again czechboy!

as advised by mouser, i've re-packed czechboy's Console plugin with the citytime files and (exe and alias) so that you only have to unzip into Farr's "Plugins" folder to get it working. btw, for those not wanting download the whole thing, this is the code that triggers the plugin:

Here's the citytime alias pack, including the citytime.exe with install instructions:

Note to alias writers who might want to use this alias pack as a template for their console-based aliases: This alias, as designed by lanux, uses the "dosearch" functionality, which results in an immediate execution of the console program with every character you type. Works well in this case but if you are going to shell out to a command that takes a while to run, you would want to use the Console plugin differently. You can use "restartsearch" keyword instead of the "dosearch" keyword to have it ONLY run the console plugin+exe when the user hits enter.

I've added a new variant of the dosearch special alias function called dosearchontrigger which basically says to only actually perform the search when user hits enter. That will be useful for using things like the console plugin to run programs that could take some time to execute.

This is essentially what the restartsearch alias action does EXCEPT that dosearchontrigger will NOT change the editbox the way restartsearch will, so it looks much nicer for things like this.