Welcome Guest.   Make a donation to an author on the site November 26, 2014, 02:12:16 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Learn about the DonationCoder.com microdonation system (DonationCredits).
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Output to Farr's memo mode  (Read 29931 times)
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: April 13, 2008, 07:16:07 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?
Logged

mouser
First Author
Administrator
*****
Posts: 33,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: April 13, 2008, 01:15:28 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.
Logged
mouser
First Author
Administrator
*****
Posts: 33,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: April 13, 2008, 01:17:04 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.
Logged
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: April 13, 2008, 08:54:34 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. smiley

Quote
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
Logged

czb
Honorary Member
**
Posts: 335



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #4 on: April 14, 2008, 04:38:29 AM »

I have coded something. But I do not know if it is what you expect smiley

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

Just tell me if it needs some modifications Wink

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...
« Last Edit: April 14, 2008, 04:57:21 AM by czechboy » Logged

My open-source online piano game: http://musicope.com/
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: April 14, 2008, 08:04:52 AM »

thanks czechboy, i'll try this out tonight and will give you some feedback. thumbs up
Logged

lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: April 16, 2008, 10:19:39 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 (&&)?
Logged

czb
Honorary Member
**
Posts: 335



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: April 20, 2008, 05:58:06 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 Wink

PS: && acts here as command separator and as "enter"
Logged

My open-source online piano game: http://musicope.com/
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: April 20, 2008, 09:00:29 PM »

thanks for the update but i can't find the download link at your website.
Logged

czb
Honorary Member
**
Posts: 335



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #9 on: April 21, 2008, 01:13:13 AM »

I am sorry it is two posts up smiley I didnt put it onto my website yet smiley

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

EDIT: or you can use dc updater Wink
Logged

My open-source online piano game: http://musicope.com/
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #10 on: April 21, 2008, 09:05:31 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


After
Logged

lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #11 on: May 05, 2008, 10:46:24 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! Cool



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:

[copy or print]
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. embarassed
« Last Edit: May 05, 2008, 11:39:44 PM by lanux128 » Logged

mouser
First Author
Administrator
*****
Posts: 33,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #12 on: May 05, 2008, 11:18:19 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.
Logged
mouser
First Author
Administrator
*****
Posts: 33,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: May 05, 2008, 11:33:22 PM »

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

* CitytimeConsole.zip (18.92 KB - downloaded 456 times.)

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:35 PM by mouser » Logged
mouser
First Author
Administrator
*****
Posts: 33,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: May 05, 2008, 11:40:48 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  thumbs up thumbs up thumbs up
Logged
mouser
First Author
Administrator
*****
Posts: 33,699



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #15 on: May 12, 2008, 01:31:52 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.
Logged
nitrix-ud
Charter Member
***
Posts: 482

View Profile Give some DonationCredits to this forum member
« Reply #16 on: May 12, 2008, 03:49:04 AM »

Quote
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 !
Logged
kartal
Supporting Member
**
Posts: 1,529


View Profile Give some DonationCredits to this forum member
« Reply #17 on: June 10, 2008, 12:57:43 AM »

I am trrying to use console plugin for pinging but I cannot make ti work. Is it supposed to handle most console commands?
Logged
czb
Honorary Member
**
Posts: 335



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #18 on: June 10, 2008, 01:23:05 AM »

it should handle all commands. I will test it when I get home this afternoon
Logged

My open-source online piano game: http://musicope.com/
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #19 on: June 10, 2008, 01:29:40 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

Logged

kartal
Supporting Member
**
Posts: 1,529


View Profile Give some DonationCredits to this forum member
« Reply #20 on: June 10, 2008, 01:44:01 AM »

Lanux how do you use ipconfig?

edit:I think I figured smiley
« Last Edit: June 10, 2008, 01:49:19 AM by kartal » Logged
jgpaiva
Global Moderator
*****
Posts: 4,711



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #21 on: June 10, 2008, 04:11:35 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?  embarassed
Logged

lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #22 on: June 10, 2008, 04:27:48 AM »

jgpaiva,this is a custom alias. smiley 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).
Logged

justice
Supporting Member
**
Posts: 1,890



Solve issues simply.

View Profile WWW Give some DonationCredits to this forum member
« Reply #23 on: June 10, 2008, 04:34:47 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?  embarassed
cn ipconfig &&
Logged

jgpaiva
Global Moderator
*****
Posts: 4,711



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #24 on: June 10, 2008, 04:48:37 AM »

ok, cool!
Apparently the problem was that it wasn't launching without the full path (Vista64 here, probably related)
Logged

Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.055s | Server load: 0.1 ]