rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: MegaGamerGuy on September 07, 2014, 09:49:10 PM
-
the exec macro is executed regardless of the if macro's return value. Basically I check to see if a file exists, if not run command to create it. well, weather or not the file exists the command runs. But, if i put "NaN" without quotes where the exec statement would go...NaN will show up in the html source when there is no file, but not when there is a file.
Thanks, and long time no see guys!
-
the instructions "covered" by an IF must be {:quoted:}
{.if| condition | {: then :} .}
i know it's strange. It's a strange and stupid language.
Sorry for the late reply.
-
This is what I have
{.set|ItemPath|{.vfs to disk|%item-url%.}.}
{.set|ItemMD5|{.md5 file|{.call|ItemPath.}.}.}
{.set|ItemIconUrl|/Data/Media/Graphics/Icons/Cache/%item-name%.{.call|ItemMD5.}.png.}
{.set|ItemIconPath|Data\Media\Graphics\Icons\Cache\%item-name%.{.call|ItemMD5.}.png.}
{.if not|{.and|{.exists|^ItemIconPath.}|{.is file|^ItemIconPath.}.}|{.exec|Data\Path2Png.exe|{.Call|ItemPath.} Data\Media\Graphics\Icons\Cache\%item-name%.{.call|ItemMD5.}.png 32.}.}
-
{.if not|{.and|{.exists|{.^ItemIconPath.}.}|{.is file|{
.^ItemIconPath.}.}.}
|{:
{.exec|Data\Path2Png.exe
|{.Call|ItemPath.} Data\Media\Graphics\Icons\Cache\%item-name%.{.call|ItemMD5.}.png 32.}
:}
.}
-
still executing regardless of the existence of png file in /Data/Media/Graphics/Icons/Cache
-
that's because there is an error in your script.
i will describe in details the problem, for those who like to learn from it.
Preamble: this programming language sucks.
Commands {.is file.} and {.exists.} work directly with the name of the file, not with variables
(few commands are able to work directly with variables, you know them because often they have a parameter called "var").
Since you have the name inside variable ItemIconPath, you have to use a specific command to access its value first.
The command is {.call|ItemIconPath.} or its shortcut {.^ItemIconPath.}
So, here we get to your problem: you put braces {} for the command "exists" but not for the command ^
You wrote {.exists|^ItemIconPath.}
but it is {.exists|{.^ItemIconPath.}.}
the same for is-file
-
Thank you.