topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Monday March 18, 2024, 11:03 pm
  • 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

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

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
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 [Select]
  1. #filecontents C:\a.txt

But if the file is not found FARR instead shows this error message
Code: Text [Select]
  1. a.txt) --> file not found
  2. 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,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: request: ignore #filecontents result line if file not found
« Reply #1 on: April 16, 2018, 10:55 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..

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: request: ignore #filecontents result line if file not found
« Reply #2 on: April 17, 2018, 12: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:

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,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: request: ignore #filecontents result line if file not found
« Reply #3 on: April 17, 2018, 01:26 PM »
That's pretty nice.. makes sense.. I will add.