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. |
![]() |
#1 | Link |
Matroska Dev
Join Date: Sep 2002
Location: Texas, USA
Posts: 230
|
Get the current script filename
Is it possible to get the filename of the current AVS script file inside a filter?
I want to make a Audio Normalizing filter that caches the the peak levels to an external file so that it only has to scan it once. ![]()
__________________
The Matroska Effect |
![]() |
![]() |
![]() |
#5 | Link |
Matroska Dev
Join Date: Sep 2002
Location: Texas, USA
Posts: 230
|
![]() I went ahead and made the filter but it takes the peak value file as an argument. Normalize2 Now with mf's function I can get similar results to what I wanted. Code:
function GetScriptName() { Try { NonExistantfiltername() } Catch(err_msg) { err_msg2 = MidStr(err_msg, 67) filename = LeftStr(err_msg2, (FindStr(err_msg2, ", line")-1)) return filename } } ... Normalize2(GetScriptName()+".norm") ![]()
__________________
The Matroska Effect |
![]() |
![]() |
![]() |
#7 | Link | |
AviSynth Enthusiast
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
|
Quote:
![]() But it won't work for the contrived case where the filename has ", line" in it. Here's a modified version (and that also isn't dependent on NonExistentFilterName): Code:
function GetScriptName() { Try { assert(false) } Catch(err_msg) { err_msg = MidStr(err_msg, FindStr(err_msg, "(") + 1) filename = LeftStr(err_msg, StrLen(err_msg) - FindStr(RevStr(err_msg), ",")) return filename } } Last edited by stickboy; 15th December 2003 at 21:40. |
|
![]() |
![]() |
![]() |
#14 | Link |
Simply me
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
|
I'm a bit confused as usual
![]() I understand the GetScriptName function (hats off to mf) but I don't understand what Normalise2 is doing with it and what is meant by caching so it only has to scan the file once ![]() I'm sure its simple but the usage has got me stumped ![]() regards Simon
__________________
http://www.geocities.com/siwalters_uk/fnews.html |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|