topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 2:37 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Output to Farr's memo mode  (Read 56496 times)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Output to Farr's memo mode
« on: April 13, 2008, 07:16 AM »
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?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #1 on: April 13, 2008, 01:15 PM »
you can't currently do it, BUT
there 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.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #2 on: April 13, 2008, 01:17 PM »
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.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #3 on: April 13, 2008, 08:54 PM »
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

czb

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 336
    • View Profile
    • My open-source online piano game
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #4 on: April 14, 2008, 04:38 AM »
I have coded something. But I do not know if it is what you expect :)

http://czb.dcmembers.../Console/Console.zip

Just tell me if it needs some modifications ;)

edit: type something like "cn cd C:\ && dir &&"

edit2: to mouser: in the moment when I type "\" (try above example) memo hint disapears... why is that?

edit3: unfortunately I do not know hot to make it work with aliases...
My open-source online piano game: https://github.com/musicope/game
« Last Edit: April 14, 2008, 04:57 AM by czechboy »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #5 on: April 14, 2008, 08:04 AM »
thanks czechboy, i'll try this out tonight and will give you some feedback. :up:

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #6 on: April 16, 2008, 10:19 AM »
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 (&&)?

czb

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 336
    • View Profile
    • My open-source online piano game
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #7 on: April 20, 2008, 05:58 AM »
Hi, I have uploaded new version (a little corrected one)
I have tested in on this:

cn "C:\Program Files\7-Zip\7z.exe" a -tzip "C:\Program Files\7-Zip\dsf.zip" "D:\dsf.txt"&&

and it worked fine ;)

PS: && acts here as command separator and as "enter"
My open-source online piano game: https://github.com/musicope/game

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #8 on: April 20, 2008, 09:00 PM »
thanks for the update but i can't find the download link at your website.

czb

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 336
    • View Profile
    • My open-source online piano game
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #9 on: April 21, 2008, 01:13 AM »
I am sorry it is two posts up :) I didnt put it onto my website yet :)

http://czb.dcmembers.../Console/Console.zip

EDIT: or you can use dc updater ;)
My open-source online piano game: https://github.com/musicope/game

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #10 on: April 21, 2008, 09:05 PM »
great work, czechboy! this works quite well. i'm testing this with a tool called CityTime and here is the output. :Thmbsup: btw, the note about the "&&" is an important clue. next, i'll try to make this work with an alias.

Before
citytime-b4.jpg

After
ws-czechboy-console-citytime-2.png

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #11 on: May 05, 2008, 10:46 PM »
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! 8)

ws-ct-time-1.png

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:

1000>>>citytime>->ct $$1| dosearch cn "%FARRDIR%\Plugins\Console\Citytime\citytime.exe" $$1 &&>+>^ct (.*)

note: CityTime is available here and distribution is subjected to the following terms.

edit: duh! forgot to attach the file. but mouser had kindly zipped everything nicely. see one post below. :-[
« Last Edit: May 05, 2008, 11:39 PM by lanux128 »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #12 on: May 05, 2008, 11:18 PM »
Some hints on how to package an alias to work with a plugin like czechboy's Console plugin:

  • Console plugin should be left alone in its plugin directory of itself, you shouldn't pack it in with your alias, that could lead to multiple copies of the plugin installed in FARR which is not good.
  • Your zip should just contain your .alias file(s) and any helper exes (in this example citytime.exe), and an optional Aliasname.ico file if you want a custom icon displayed with your alias.
  • To refer from your alias to a file or exe program inside your alias' directory, use %ALIASDIR%
  • Instruct the user to unpack your alias subdirectory into the FARR AliasGroups/MyCustom directory, and then restart FARR.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #13 on: May 05, 2008, 11:33 PM »
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.
« Last Edit: May 05, 2008, 11:39 PM by mouser »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #14 on: May 05, 2008, 11:40 PM »
By the way.. this is long overdue:

czechboy, thank you for another awesome javascript plugin -- this Console plugin is INCREDIBLY useful, and i'm sure in time a lot of people will find ways to use it to create some cool alias packs  :up: :up: :up:

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #15 on: May 12, 2008, 01:31 AM »
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.

It will be in the next update.

nitrix-ud

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 560
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #16 on: May 12, 2008, 03:49 AM »
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.


nice add, i think it will be useful for searching on remote folder too !

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #17 on: June 10, 2008, 12:57 AM »
I am trrying to use console plugin for pinging but I cannot make ti work. Is it supposed to handle most console commands?

czb

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 336
    • View Profile
    • My open-source online piano game
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #18 on: June 10, 2008, 01:23 AM »
it should handle all commands. I will test it when I get home this afternoon
My open-source online piano game: https://github.com/musicope/game

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #19 on: June 10, 2008, 01:29 AM »
i tried pinging too but it doesn't work very well due to the need to refresh the display but static displays such as ipconfig works well. :Thmbsup:

ws-console-ipconfig.png

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #20 on: June 10, 2008, 01:44 AM »
Lanux how do you use ipconfig?

edit:I think I figured :)
« Last Edit: June 10, 2008, 01:49 AM by kartal »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #21 on: June 10, 2008, 04:11 AM »
Now this is strange.. I can't configure farr to use ipconfig, doing "cn ipconfig" gives me no answer from farr (even after pressing enter)
What am i doing wring?  :-[

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #22 on: June 10, 2008, 04:27 AM »
jgpaiva,this is a custom alias. :) with czechboy's console plugin, create an alias with the following parameters:

regex: ^ipconfig (.*)
result(s): dosearch cn ipconfig &&

note: if this doesn't work, insert the full path to ipconfig (in the system32 folder on WinXP).

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #23 on: June 10, 2008, 04:34 AM »
Now this is strange.. I can't configure farr to use ipconfig, doing "cn ipconfig" gives me no answer from farr (even after pressing enter)
What am i doing wring?  :-[
cn ipconfig &&

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Output to Farr's memo mode
« Reply #24 on: June 10, 2008, 04:48 AM »
ok, cool!
Apparently the problem was that it wasn't launching without the full path (Vista64 here, probably related)