Log in

View Full Version : Reading files with AviSynth


buzzqw
4th May 2009, 13:57
Hi all

how to script to apply a fuction when a files is present on disk ?

for example: i want to apply a fuction/filters if on a specific folder is preset a specific files

on pseudo code

if c:\test.txt exist then apply removegrain()

thanks!

BHH

mgh
4th May 2009, 14:05
use the exist function!
exist(your file)
file exists it returns true, else false
see syntax.htm in avisynth docs

buzzqw
4th May 2009, 14:19
will be correct this ?

exist("c:\greyscale.txt") ? greyscale() : nop()

BHH

IanB
4th May 2009, 22:54
Nop() is a bit of a misnomer, it actually returns Null. You just want to reuse Last in the else case.exist("c:\greyscale.txt") ? greyscale() : Last

Gavino
5th May 2009, 00:14
Nop() is a bit of a misnomer, it actually returns Null. You just want to reuse Last in the else case.
That's true, but nop() will still work equally as well, unless it's the last line of the script.

It's not widely known, but Last is only updated implicitly for clip values, so
exist("c:\greyscale.txt") ? greyscale() : nop()
leaves Last untouched in the else case.

[That's why, for example, a call to LoadPlugin does not affect Last.]

buzzqw
5th May 2009, 13:49
thanks IanB, thanks Gavino!

BHH