rejetto forum

an infinite loop

Mars · 2 · 1470

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2039
    • View Profile
Here is craftiness to fill the log with the macro RENAME

create an new real folder
create a file named old.txt
put the attached hfs.diff.tpl into the new folder

and include the [on macro rename] section in the hfs.events

Quote from: hfs.diff.tpl
{.add to log|hfs.diff.tpl: macro rename|color=red.}
{.rename|%folder-resource%\old.txt|%folder-resource%\new.txt|recursive=1.}

Quote from: hfs.events
[+on macro rename]
{.add to log|hfs.events: macro rename
%old-name%
%new-name%
|color=red.}
{.rename|%new-name%|%old-name%|recursive=1.}


It is as in a play of ping-pong  :D

old-name >> new-name >> old-name >> new-name >> old-name >> new-name >> ........

It is beautiful the recursion, especially when we do not know where it is necessary to use it. ;D ;D


HFS BUILD 244
+ running a {.rename.} during [on macro rename] won't fire the event again (but you can override this with parameter "recursive")
« Last Edit: March 09, 2010, 01:43:39 PM by Mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13308
    • View Profile
you may need multiple automatic renaming rules. in such case you may need to control when to stop recursion.
if you are using the "recursive" parameter then you are supposed to know what you are doing.
you can use an {.if.} to decide to stop recursion.
point is: it's off by default.
if you want to deliberately make an infinite loop there is an easier way: {.while|timeout=0.} ;)
« Last Edit: March 09, 2010, 01:49:37 PM by rejetto »