ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Find And Run Robot

Use of Variables inside Aliases

<< < (2/2)

Just to add to mouser's suggestion:
You can use the list approach together with RegEx and RegEx result filter to ensure that only the list items are shown in results, and filtered as you type. Without RegEx unwanted files that contain the keyword string might also show up in the results.

Example of what I mean with RegEx result filter:

With the above you'd type "gg" to get the whole list and nothing else. Then keep typing to filter the list.

Excellent! Thanks a lot for the support.

The suggested use of a Filtered Alias list is indeed the better option: more dynamic and easier to maintain than a list of variables. Still I wish I could use variables inside aliases!


I think I should be able to fix your problem -- sounds like it's just a matter of the order that FARR replaces variables and regex values, and that regex $$n values should be resolved first.
-mouser (April 26, 2019, 06:13 PM)
--- End quote ---

Consider adding a list with the resolving order to the helpfile after the changes. Things that might resolve in some order or other:  %uservar.myvar.hundred% variables, $$1 regex matches, the new fileresults command, the older #filecontents command.

Helpfile says that #filecontents can be used recursively (haven't tried it) so FARR already resolves at least the string "#filecontents" for that command. But does/should #filecontents and fileresults commands also resolve %uservar.myvar.hundred% and $$1 in the file contents and if yes in what order?

Hypothetical, overly complex edge case example
- User types input that triggers a FARR alias with RegEx that puts the string "file" in $$1 and "cool" in $$2
- The alias has this results line:

--- ---fileresults C:\folder\%uservar.myvar.$$1%.txt- with the suggested change in this thread that line would first resolve to

--- ---fileresults C:\folder\%uservar.myvar.file%.txt- imagine the variable %uservar.myvar.file% contains string "testingfile", we then get

--- ---fileresults C:\folder\testingfile.txt- imagine that file contains:

--- ---#$$1contents C:\folder\results.txt- which, if command fileresults resolves $$1, will resolve to the command

--- ---#filecontents C:\folder\results.txt- imagine that file in turn contains

--- ---C:\here\%uservar.othervar.$$2%.txt- which, again if command #filecontents also resolves $$1 and % variables, resolves to

--- ---C:\here\ which, imagine, resolves to

--- ---C:\here\final_file.txt- which contains
SpoilerNever gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you


Yes, I should provide a list of order of resolution.  Even smarter might be to have FARR resolve what it can, and defer resolving those that it can't if they might be expanded by another.
Spoiler ha !  ;D


[0] Message Index

[*] Previous page

Go to full version