Spliff
12-26-2023, 08:21 AM
I use many / within item titles, other users would do the same but most users don't use UR's item "commandline" (in "Tools - Options - Miscellaneous"), so they don't get aware of the problem; for macros though, the current / is a bad choice since that makes it impossible to distinguish the path levels from possible / within titles.
I'd prefer \ instead, but possibly, some users could complain because they use that char within web link item titles? (I have never done that, so don't know if that could be a problem?)
Then, the | should be acceptable for everybody, since nobody (?) would ever use that char within any of their item titles?
At the end of the day, there MUST be a char that would not be used within item titles, AND that would be available then as the new level separator char for %item_path_titles% (what about ¬ if even | might not be acceptable? but that might become a problem since it's not 1 but 2 chars, according to the UTF, ANSI or whatever in use! whilst | is always just 1 char, from my experience)!
I use | as separator char between my different %elements% within the "commandline", but I could, without problems, using the %item_path_titles% as LAST element in there anyway, separate it from the elements before that one, not by | anymore, but by a double ||, and then, macro-wise, it would remain without any problem:
Currently, I do
pos := instr(clipboard, "|",, 0) ; finds the very last occurrence, then
path := substr(clipboard, pos+1) ; and up to the end by default
Then, I would do
pos := instr(clipboard, "||") ; would be the only occurrence, then:
path := substr(clipboard, pos+2) ; and up to the end by default
instead, and in both cases, "path" is the item_path_titles of the current item, currently
drive:/path/UR-db-name.db (or .urd)/root/firstlevel/secondlevel/etc
But any / within (sic!) any of those path elements, i.e. within some level-element, will brake any macro, i.e. identify a wrong path, instead of a correct one, since any macro would proceed separate the level-elements by those "/", even if they are just / within a title.
(For the current element only, but not also for a parent-element, %title% can be used to compare with the alleged last element in %item_path_titles%, so if there is a "/" in it, and not also within "upper" elements of the path, this can be corrected, and also, %path% (= id-numbers) can be used in order to check (sic!) for a faulty path element separation in %item_path_titles%, since the element numbers from both variables, must be identical, and if they are not, you know there is at least 1 "/" within any element, but you can't correct that, you can just stop the macro with an error message, instead of letting it doing wrongdoings, but that obviously is not my preferred solution to this recurring problem...)
EDIT:
It seems that web-links come with "/" so that those could be preserved, and "" (which would be most natural anyway, since "" are the standard for file system paths) could be used for the UR variable, since nobody would enter file system paths in UR item titles? Or then, some users do, and that would be precisely the reason why also "" should be avoided, using "|" as level separators instead?
I'd prefer \ instead, but possibly, some users could complain because they use that char within web link item titles? (I have never done that, so don't know if that could be a problem?)
Then, the | should be acceptable for everybody, since nobody (?) would ever use that char within any of their item titles?
At the end of the day, there MUST be a char that would not be used within item titles, AND that would be available then as the new level separator char for %item_path_titles% (what about ¬ if even | might not be acceptable? but that might become a problem since it's not 1 but 2 chars, according to the UTF, ANSI or whatever in use! whilst | is always just 1 char, from my experience)!
I use | as separator char between my different %elements% within the "commandline", but I could, without problems, using the %item_path_titles% as LAST element in there anyway, separate it from the elements before that one, not by | anymore, but by a double ||, and then, macro-wise, it would remain without any problem:
Currently, I do
pos := instr(clipboard, "|",, 0) ; finds the very last occurrence, then
path := substr(clipboard, pos+1) ; and up to the end by default
Then, I would do
pos := instr(clipboard, "||") ; would be the only occurrence, then:
path := substr(clipboard, pos+2) ; and up to the end by default
instead, and in both cases, "path" is the item_path_titles of the current item, currently
drive:/path/UR-db-name.db (or .urd)/root/firstlevel/secondlevel/etc
But any / within (sic!) any of those path elements, i.e. within some level-element, will brake any macro, i.e. identify a wrong path, instead of a correct one, since any macro would proceed separate the level-elements by those "/", even if they are just / within a title.
(For the current element only, but not also for a parent-element, %title% can be used to compare with the alleged last element in %item_path_titles%, so if there is a "/" in it, and not also within "upper" elements of the path, this can be corrected, and also, %path% (= id-numbers) can be used in order to check (sic!) for a faulty path element separation in %item_path_titles%, since the element numbers from both variables, must be identical, and if they are not, you know there is at least 1 "/" within any element, but you can't correct that, you can just stop the macro with an error message, instead of letting it doing wrongdoings, but that obviously is not my preferred solution to this recurring problem...)
EDIT:
It seems that web-links come with "/" so that those could be preserved, and "" (which would be most natural anyway, since "" are the standard for file system paths) could be used for the UR variable, since nobody would enter file system paths in UR item titles? Or then, some users do, and that would be precisely the reason why also "" should be avoided, using "|" as level separators instead?