Author Topic: A couple of macro requests  (Read 1002 times)

0 Members and 1 Guest are viewing this topic.

Offline Flynsarmy

  • Occasional poster
  • *
  • Posts: 92
  • DENIED!
    • View Profile
    • Flynsarmy
A couple of macro requests
« on: September 01, 2009, 07:40:59 AM »
I'm not sure if there are undocumented macros that already do this, but could you please add
{.exists.} - accepts path/path+filename. returns true if folder/file exists respectively.
{.isfile.} - accepts path/path+filename. returns true if path is a file instead of folder (some files dont have file extensions).
The reason for {.isfile.} is because if you have a file with no file extension it could look like a folder. also {.isfile.} could be combined with {.exists.} to determine if a file exists or a folder exists.

I was using filesize before but this returns 0 for empty files or folders (which would indicate that they dont exist) and md5 is ALOT slower - speed is important.

The reason i ask for these is because I currently use this code:
{.copy|{.postvar|src.}|{.postvar|destination.}.}
{.if|{.filesize|{.postvar|destination.}.}|1|0.}

It performs a copy then returns 1 if the destination file exists on the hard drive (successful copy) or 0 if the destination file doesn't exist (failed copy). This is perfect unless the file size is 0 in which case i have no way of telling if the destination file exists or not...

Another, much preferred solution would be to have both the move and copy macros return true on a successful operation and false on a failed operation. This would allow me to do this:
{.if|{.copy|{.postvar|src.}|{.postvar|destination.}.}|1|0.}
« Last Edit: September 01, 2009, 11:45:29 AM by Flynsarmy »

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: A couple of macro requests
« Reply #1 on: September 04, 2009, 02:03:54 PM »
you will get both macros in next build.

anyway, i guess this is not documented, but several commands that apparently return no result, but you would like to, actually DO. :)
they return a white space or not.
this way, you can
{.if|{.length|{.copy|SOURCE|DESTINATION.}.}|all right|something's wrong.}

i will document this fact
« Last Edit: September 04, 2009, 02:09:56 PM by rejetto »

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1895
    • View Profile
Re: A couple of macro requests
« Reply #2 on: September 04, 2009, 02:06:47 PM »
{.copy|from|to.}  ???

missing something? not ?
{.copy|url|from|to.}

Offline rejetto

  • Administrator
  • Tireless poster
  • *
  • Posts: 12953
    • View Profile
Re: A couple of macro requests
« Reply #3 on: September 04, 2009, 02:09:36 PM »
"from" and "to" are meta-names, supposed to be replaced by the real content ;)
not meant to be named parameters from=XXX