Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th June 2009, 06:08   #1  |  Link
kypec
User of free A/V tools
 
kypec's Avatar
 
Join Date: Jul 2006
Location: SK
Posts: 830
Using environment variables in scripts - is it possible?

I'm trying to make use of system variables for portability of my scripts across more OS but the following syntax doesn't work for me:
Code:
LoadCPlugin("%PROGRAMFILES%\AVTools\Plugins\yadif.dll")
Is there any way to tell Avisynth to use these path notations instead of hardcoded paths within filename strings?
Please note that this is a 'C' plugin and as such is not recommended to be put in common plugins autoload directory.

Last edited by kypec; 8th April 2011 at 09:21.
kypec is offline   Reply With Quote
Old 19th June 2009, 08:01   #2  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Take a look at the GetSystemEnv plugin. You can use this to load environment variables…

… or, in my case:

I use GetSystemEnv to find the AviSynth plugins folder by creating a file called AviSynthPluginsDir.avsi, which is auto-loaded. The file contains:

Code:
global AviSynthPluginsDir = GetWorkingDir()
When this .avsi is autoloaded, it will assign a global variable called AviSynthPluginsDir that can be accessed by other scripts.

So, for C:\Program Files\AviSynth 2.5\plugins\yadif\yadif.dll you can use:

Code:
LoadCPlugin(AviSynthPluginsDir + "yadif\yadif.dll")
vampiredom is offline   Reply With Quote
Old 13th April 2010, 23:05   #3  |  Link
RedDwarf1
RedDwarf Fan
 
Join Date: Jun 2005
Location: United Kingdom
Posts: 188
This seemed like it could be useful to me as I have multiple windows installs and need to use scripts in each of them so they need to be portable between different windows.

But it is not full working. I am getting an error every time AvsP starts.

Code:
Error parsing GetSystemEnv_GetSystemEnv plugin parameters: unknown character
Other than the error it works but it's a bit annoying having to close an error window every time I start AvsP. Is there a reason for this error message?

lol I typed it out rather than copying it and now it works without errors. The text looked identical but couldn't of been.

So if you copy it, you could get an error!

Last edited by RedDwarf1; 13th April 2010 at 23:10.
RedDwarf1 is offline   Reply With Quote
Old 14th April 2010, 11:19   #4  |  Link
Vitaliy Gorbatenko
viterra
 
Join Date: Feb 2003
Location: St. Peterburg, Russia
Posts: 142
Much easy!!!:

SetWorkingDir("C:\system\Knot\AviSynthPlugins\")
import("Killer.avsi")
import("MVDegrain2i.avsi")
LoadPlugin("bifrost.dll")
[...]

Not more full path!!
Vitaliy Gorbatenko is offline   Reply With Quote
Old 14th April 2010, 11:32   #5  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
Quote:
Originally Posted by RedDwarf1 View Post
lol I typed it out rather than copying it and now it works without errors. The text looked identical but couldn't of been.

So if you copy it, you could get an error!
I don't understand. Type what out? Copy what?
stickboy is offline   Reply With Quote
Old 14th April 2010, 15:08   #6  |  Link
RedDwarf1
RedDwarf Fan
 
Join Date: Jun 2005
Location: United Kingdom
Posts: 188
Quote:
Originally Posted by Vitaliy Gorbatenko View Post
Much easy!!!:

SetWorkingDir("C:\system\Knot\AviSynthPlugins\")
import("Killer.avsi")
import("MVDegrain2i.avsi")
LoadPlugin("bifrost.dll")
[...]

Not more full path!!
I wanted to keep the AVISynth installs separate incase anything conflicts. Done your way would mess up other parts of my script, requiring full paths to reference files. vampiredom's way works nicely.

Quote:
Originally Posted by stickboy View Post
I don't understand. Type what out? Copy what?
Copying the text posted by vampiredom:
Code:
global AviSynthPluginsDir = GetWorkingDir()
and pasting into Notepad (++) and it must of copied some extra character(s) from this forum which made AvsP/AVISynth object to a special character which got copied which produced the error window.

Typing it out into Notepad and saving worked correctly.

[EDIT]
But whatever happened I cannot reproduce it now. The original file still causes the problem and looks identical to the working one. The format is identical Dos/Windows ANSI

Last edited by RedDwarf1; 14th April 2010 at 15:45.
RedDwarf1 is offline   Reply With Quote
Old 17th April 2010, 01:07   #7  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,406
Quote:
Originally Posted by RedDwarf1 View Post
I am getting an error every time AvsP starts.
Code:
Error parsing GetSystemEnv_GetSystemEnv plugin parameters: unknown character
lol I typed it out rather than copying it and now it works without errors. The text looked identical but couldn't of been.
I have discovered this is due to a bug in Avisynth's mechanism for communicating plugin parameters to applications, and can occur if a function from an auto-loaded plugin is called from an auto-loaded .avsi file. See here.

Because it involves memory corruption, the problem does not always show up, which explains why your two tests behaved differently.
Gavino is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.