I am wondering if AviSynth has a built in path variable, which basically stores the string that corresponds to the current path where .avs file resides on the hard drive. (For instance, if you are familiar with batch file programming in DOS, that would correspond to %~dp0)
The reason for that is makeAVIS.
Usually, I keep .avs file in the same folder as the video files I reference with it. Thus, I typically would only need to specify the file name, rather than the full path.
e.g.
That's fine until I try to use makeAVIS which for some reason requires that I use absolute paths.Code:file_a = "VideoA.avi" file_b = "VideoB.avi" AVISource(file_a) AVISource(file_b) ...
So, my solution has been to have a script_path variable:
The slight problem with that is that if I move my files to a different folder, I have to make sure to change that script_path variable, too.Code:script_path = "<current avs path>\" ... ... AVISource(script_path+file_a) ...
And if I have many .avs files that gets to be a drag.
So, if there was a built in "script_path" variable, which I didn't have to define explicitly in my code, that would be so great.
Thanks,
a1
+ Reply to Thread
Results 1 to 14 of 14
-
-
Control functions
SetWorkingDir | v2 | SetWorkingDir(path)
Sets the default directory for AviSynth to the path argument.
This is primarily for easy loading of source clips, importing scripts, etc. It does not affect plugins' autoloading.
Return value is 0 if successful, -1 otherwise.
Examples:
SetWorkingDir("c:\my_presets")
AviSource("border_mask.avi") # this loads c:\my_presets\border_mask.avi
You could have one script in each folder that defined the directory and Import it into each script.
Or you could put it as an AVSI in your Plugins folder and it would be automatically imported; you would only have to update that one script.
You could write a batch file to create your definition file.
Sign up at http://forum.doom9.org/index.php and ask there; that's where you find the gurus.Last edited by AlanHK; 12th Nov 2010 at 02:12.
-
There is a GetWorkingDir in stickboy's GetSystemEnv plugin.
There is also a hack (again by stickboy) which gets the name of the current script file:
http://forum.doom9.org/showthread.php?p=413006#post413006
However, I don't understand why there is a problem with makeAVIS.
Inside Avisynth, the current folder is set to the one containing the script file, so
AviSource("VideoA.avi")
should always work if VideoA.avi is in the same folder as the script.
Perhaps makeAVIS is copying the script to another folder, in which case knowing what the current folder is won't help you to find the video files. -
Gavino, you are probably right about makeAVIS copying the .avs somewhere. (GetWorkingDir doesn't work with it).
Probably have to just keep renaming my path variable manually each time I move my files. -
Not a message box, but you could write it to a file using
WriteFileStart(BlankClip(), "C:\mydir\workingdir.txt", "GetWorkingDir()")
Alternatively, use the full path in AviSource (to avoid the error) and then
Subtitle(GetWorkingDir())
to display it on the output. -
Got it. So, it is basically whereever I happen to run makeAVIS from. (I open my command line, and it goes to c:\Documents and Settings\my username
So an easy work around is:
I use batch files (that reside in a folder that's on system path). One batch file is called makeavis1.bat. As an argument it accepts one avs file and makes avi file with the same name/path as avs.
So, before the line in my batch file that calls makeavis.exe, I simply cd "%~dp1", which changes the directory to the one where my .avs file is.
Good enough for me. -
Ok, found a problem.
So, even though my trick does get makeavis to compile the avs into avi (I use the -V switch so I see that it seemingly does it correctly).
Then, when I try to open it, the compiled avi file, in virtualdub I get the error:
---------------------------
ffdshow error
---------------------------
AVISource autodetect: couldn't open file 'C:\Documents and Settings\my username\<name of the avi file that my avs script is trying to reference>'
Error code: 2
(ffdshow_dec_avisynth_script, line 6)
---------------------------
OK
---------------------------
So, as soon as I change my path variable to use an explicit path ("C:\PathToMyAVIFile\"), instead of GetWorkingDir(), the compiled AVI opens correctly. -
I need AVS to turn into "fake" AVIs so that I can open them in my video editor (which doesn't understand what to do with AVS files).
-
Very big newbie here. I got thrown into this for encoding HD video files down to SD. My problem is that i get an error message from VirtualDub (below) and i even have the plugin GetSystemEnv.dll. I've hit a brick wall and this is the closest thread i've found that resembles my problem. Is there a work around? or am i missing a step i don't see?
Error Message:
Avisynth open failure:
Script error: there is no function named "GetWorkingDir"
(aviSynthPluginsdir.avsi, line 1)
Go easy on me, i'm very new and have been working on trying to get my .d2v file into virtualdub for over a week now and keep running into errors.
Hopefully one of you amazing guru's can help this poor soul! -
-
No, it's nothing to do with your problem.
Start a new thread and in that quote your entire AVS script if you want any useful help.[/QUOTE]
Thanks for the advice, I realized that very quickly and have created a new thread.
https://forum.videohelp.com/threads/388548-HD-to-SD-encoding-with-DGindex-Avisynth-VirtualDub
Similar Threads
-
Should i use and avisynth script for Dv ?
By smartel in forum Newbie / General discussionsReplies: 0Last Post: 10th Mar 2012, 08:29 -
How to display variable values 4 debuggin in Avisynth
By lindylex in forum ProgrammingReplies: 15Last Post: 6th Dec 2009, 09:36 -
Avisynth Script Help
By jamhat in forum Video ConversionReplies: 2Last Post: 29th Nov 2009, 06:13 -
Avisynth script
By daz2712 in forum Video ConversionReplies: 2Last Post: 19th Aug 2009, 11:08 -
avisynth script
By magenta2007 in forum SVCD2DVD & VOB2MPGReplies: 7Last Post: 25th Sep 2007, 11:29