DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: request: ignore #filecontents result line if file not found  (Read 6,760 times)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,175
    • Coding Snacks
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
FARR has the special string that lets us import one or more alias results line from a file. For example an alias can put the below string in the alias results setup and whatever is in C:\a.txt will be included in the results when a matching search is done.

Code: (text)
#filecontents C:\a.txt

But if the file is not found FARR instead shows this error message
Code: (text)
a.txt) --> file not found
Error processing alias contents: C:\a.txt(C:\

Request: if the file isn't found FARR should simply ignore that line in the alias results instruction.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: request: ignore #filecontents result line if file not found
« Reply #1 on: April 17, 2018, 03:55 AM »
I'm a little wary of not showing any message if file is not found.  But I could put the error in the status bar, or i could make a #filecontentsi command that is similar but ignores error..

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,175
    • Coding Snacks
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
Re: request: ignore #filecontents result line if file not found
« Reply #2 on: April 17, 2018, 05:08 PM »
I'm a little wary of not showing any message if file is not found.  But I could put the error in the status bar, or i could make a #filecontentsi command that is similar but ignores error..
You're right that is probably better. A new #filecontentsifexist (or something like that) would be useful.

One thing I use #filecontents for is to add a status/notification text line in some alias results. For example imagine an alias with 3 alternative backup commands as result. We can with #filecontents add an extra result line that reads a textfile generated by one of those three commands last time it ran. So the results can look something like:

Code
backup command b1
backup command b2
backup command b3
Last run: b1 2018-02-15 success

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: request: ignore #filecontents result line if file not found
« Reply #3 on: April 17, 2018, 06:26 PM »
That's pretty nice.. makes sense.. I will add.

Original address: https://www.donationcoder.com/forum/index.php?topic=45387.0