Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • December 10, 2017, 10:14 PM
  • Proudly celebrating 10 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

Author Topic: #filecontents FILEPATH -- how does it work?  (Read 4528 times)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
#filecontents FILEPATH -- how does it work?
« on: March 02, 2009, 05:14 PM »
the new FARR 2.48.01 has added this:

#filecontents FILEPATH (can use %ALIASDIR%), to have the contents of the file dumped into the alias results when searching.

My first though that the FILEPATH should point to a textfile (e.g. C:\test\test.txt ) that includes paths to other files. Each such included path is then listed as a result in FARR when the alias runs. But that did not work when I tested it. So what exactly does it do?  :tellme: An example of an exported alias using this would be useful here.

nitrix-ud

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 555
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #1 on: March 03, 2009, 01:38 AM »
hi Nod5,

i'll post a short tutorial about this feature when i have some time.

however just try to add that in front of your #filecontents command :

anything will do | #filecontents FILEPATH...

it seems that the "|" is needed to make it work  :huh:

cheers, Nitrix

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #2 on: March 03, 2009, 03:42 AM »
Aha, ok now I got it working.
Example: 1000>>>aoao>->test | #filecontents C:\test\a.txt
(and in a.txt put a filepath as a string )

It does not seem to work in companion with other alias specials:
1000>>>photo>->photo $$1 | dosearch +photo_modifier $$1 #filecontents C:\test\a.txt>+>^photo (.*)
Maybe it isn't supposed to work in such cases. But it would be cool if it did. I.e. if we got the results from the file at top and below it any and all matches from the search.

nitrix-ud

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 555
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #3 on: March 03, 2009, 08:37 AM »
as i understant it, the idea of the #filecontents command is to "only" externalize the list of results you put inside the result box within a alias edit dialog to an external file
so that you can edit your alias or share it much more easily

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #4 on: March 03, 2009, 10:06 AM »
huh?  :huh:

nitrix-ud

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 555
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #5 on: March 03, 2009, 10:38 AM »
sorry if i'm not clear enough ;)

take a look at my tiny tutorial to see what i mean :
http://www.donationcoder.com/forum/index.php?topic=17270.0

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #6 on: March 03, 2009, 03:33 PM »
Ok, got it now. Then it can't do what I was most hoping for. That is combine the results from the .txt (placed first in the results) AND the results from a FARR search (placed last).

I can see the use of it for other purposes though. But I'm not sure how it makes alias sharing easier... Before, you only needed to do an export and the copy+paste that. With #filecontents you both need to export and copy+paste AND copy the external .txt file.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,676
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #7 on: March 03, 2009, 03:46 PM »
That is combine the results from the .txt (placed first in the results) AND the results from a FARR search (placed last).


someone could make an fsubscript plugin to do this very easily i think.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,865
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #8 on: March 04, 2009, 01:15 AM »
I'm not sure I'm following Nod5's idea very clearly.

Reflecting on the following bits from the perspective of a plugin implementation:

a textfile (e.g. C:\test\test.txt ) that includes paths to other files. Each such included path is then listed as a result in FARR when the alias runs.

That is combine the results from the .txt (placed first in the results) AND the results from a FARR search (placed last).

The first bit raises the question of how the plugin finds which file to work w/:

  • via a special file extension?
  • via a user variable setting made by the user?
  • via a specific directory (or multiple directories) to look in?
  • or some other means...

The second bit has me wondering about how to ensure that all items from the file (.txt or something else appropriate) appear before all other results.  Very large score inflation?

Any thoughts?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,676
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #9 on: March 04, 2009, 05:56 AM »
ewe,
to keep things simple you might simply:
1) let user specify a filename in the user variables where the result alias will be found
2) let user specify a score to be applied to all of the items, but then return the results such that farr can add its score to that score.

actually now that i type this out, perhaps this would be best implemented in core FARR functionality..

perhaps what i should do is make it so that if you type +ALIASNAME it will *add* the alias contents (including obeying a #filecontents) into the current search results (with their configured score), but *not* to the exclusion of other searching.  i think that would accomplish what is desired.
« Last Edit: March 04, 2009, 06:00 AM by mouser »

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #10 on: November 19, 2017, 09:41 AM »
Holy necro thread revival!  :) But on topic I think.

I want to make a FARR alias that first runs an external script and thereafter displays results from that script as a list of files in the regular FARR search results window. Not as a html view.

Request: make the #filecontents virtual string compatible with other, preceding virtual strings and the ;;; command .

I'm thinking of a use case like this:
alias trigger:
zzz
results:
| dolaunch appcap C:\script.ahk ;;; #filecontents C:\list.txt

The alias would first run C:\script.ahk which does something and then outputs a newline separated list of filepaths to C:\list.txt . FARR thereafter moves on to the #filecontents command. Which reads list.txt as rows for the alias results box , which are then displayed in the FARR search results window.

Alternative request to achieve the same end result:
Add a new virtual launch string, for example "showfilelist FILENAME", that can be used to import a linebreak separated plaintext list of files to display as search results . Must also be compatible with ;;; and other, preceding virtual strings.

Edit:
I realized this two alias workaround is a way to do it. But a one alias method would be less messy.
first alias:
zzz
results:
| dolaunch appcap C:\script.ahk ;;; restartsearch zzx
second alias:
zzx
results:
| #filecontents C:\list.txt
« Last Edit: November 19, 2017, 10:03 AM by Nod5 »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,676
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #11 on: November 19, 2017, 11:18 AM »
I will implement this.. However I believe there is already a virtual command in FARR that launches a command script and grabs the output to show as a result list, which is basically what you are interested in (though in your case your want to have a script that saves to a file and then have farr read that file as a filecontents).

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 866
    • View Profile
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #12 on: November 19, 2017, 12:49 PM »
Great to hear. I think virtual commands that ease input/output of this sort can be quite useful, since they enable users to do plugin-ish things with some well crafted aliases and simple Autohotkey scripting (simple compared to learning to code FARR plugins).

I believe there is already a virtual command in FARR that launches a command script and grabs the output to show as a result list

I don't see anything on this list would do that
http://www.donationc...l_launch_strings.htm

Grabbing output from some external process can also be useful. Though when using Autohotkey it is easier/shorter to read from a plaintext file and/or the clipboard.
« Last Edit: November 19, 2017, 12:56 PM by Nod5 »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,676
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: #filecontents FILEPATH -- how does it work?
« Reply #13 on: November 19, 2017, 01:12 PM »
Maybe when I thought of that command I was thinking about Launchbar Commander.. The overlap in functionality is large enough that I often confuse myself between the two of them.. I will check and add the functionality if it doesn't exist yet..