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. |
28th December 2012, 18:08 | #1 | Link |
C64
Join Date: Apr 2002
Location: Austria
Posts: 830
|
Get the calling program of an avisynth script
Hi!
Is it possible to get the name of the program which called the current script? My sample usage would be: virtualdub calls script -> don't use e.g. deshaker filter else -> use deshaker Of course, any hint how to achieve the same is welcome, too! |
28th December 2012, 20:04 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
This gets a number of hits in google:- "get parent process name"
you'de need a plugin of course.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
29th December 2012, 13:05 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Not already existing, but having a go at your requirement.
So far, got a plug that outputs list of current processes, names, PID, parent PID (to Debugview). Found that what you want is actually the name of the current process rather than parent (did not know if Avisynth dll had it's own process ID or not, I am not a Win programmer). I'll have it return a string (process name) if successful and maybe an int or bool to flag failure. When it's done, (not too long I hope) perhaps you would be good enough to give a report on how it fares and on what system.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 29th December 2012 at 19:35. |
29th December 2012, 14:20 | #5 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Last bit was easier than anticipated, here it is:
http://www.mediafire.com/?3ri1n01hh3wacmy Code:
GetProcessName(bool "Parent"=false,bool "Debug"=false) Args:- Parent, if false gives name of current process (eg mplayer2.exe or VirtualDubMod.exe). if true gives name of parent to current process (eg Explorer.exe or AVSEdit.exe). Debug, if true outputs stuff to DebugView (need debugview, see google) Returns:- Type int -1 = Cant create process snapshot. (CreateToolhelp32Snapshot) -2 = Cant walk Process List. (Process32First) -3 = Cant find my own PID in process list (???). -4 = Cant find Parent PID in process list (No longer executing). Type String = ExeName as shown in Taskmanager. Test Script GetProcessName.avs # ----------------------- Me = GetProcessName(parent=false,debug=true) RT_Debug("MY NAME IS ",String(Me)) Mum= GetProcessName(parent=true ,debug=true) RT_Debug("MUMS NAME IS ",String(Mum)) return colorbars() # Avoid ThrowError # ----------------------- Gives this output in DebugView 00000004 1.88071465 [3364] GetProcessName: ExeFile = VirtualDubMod.exe 00000005 1.88075864 [3364] GetProcessName: ProcessID = 0x00000D24 00000006 1.88080537 [3364] GetProcessName: Threads = 3 00000007 1.88085139 [3364] GetProcessName: ParentProc = 0x00000140 00000008 1.88463914 [3364] RT_Debug: MY NAME IS VirtualDubMod.exe 00000009 1.88716698 [3364] GetProcessName: ExeFile = VirtualDubMod.exe 00000010 1.88721681 [3364] GetProcessName: ProcessID = 0x00000D24 00000011 1.88726258 [3364] GetProcessName: Threads = 3 00000012 1.88730943 [3364] GetProcessName: ParentProc = 0x00000140 00000013 1.88757229 [3364] GetProcessName: ExeFile = explorer.exe 00000014 1.88761711 [3364] GetProcessName: ProcessID = 0x00000140 00000015 1.88766301 [3364] GetProcessName: Threads = 13 00000016 1.88770759 [3364] GetProcessName: ParentProc = 0x000007DC 00000017 1.88853240 [3364] RT_Debug: MUMS NAME IS explorer.exe Tested only on XP32 (XP and above, NOT W2K) If a Win progger could check out the source for obvious errors, that would be nice. Thank you. EDIT: Tested on XP32, Vista32, W7-32 & also works on W2K EDIT: Detects AVSPmod fine.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th December 2012 at 05:35. |
29th December 2012, 14:46 | #6 | Link |
Registered User
Join Date: Dec 2007
Location: Enschede, NL
Posts: 301
|
See here: http://forum.doom9.org/showthread.ph...97#post1260197
And download the plugin here: http://www.roelofs-coaching.nl/blobs...rogramName.zip
__________________
Roelofs Coaching Last edited by jmartinr; 20th December 2015 at 23:51. Reason: update download link |
29th December 2012, 16:40 | #7 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Post #5 updated with two new args Parent and Debug. (will also be adding to RT_Stats).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 29th December 2012 at 17:07. |
29th December 2012, 19:44 | #9 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Verify, W2K work OK ? (not supposed to).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
30th December 2012, 04:42 | #11 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
GetCurrentProcessId : Minimum supported client Windows XP [desktop apps only]
http://msdn.microsoft.com/en-gb/libr...=vs.85%29.aspx CreateToolhelp32Snapshot : Minimum supported client Windows XP [desktop apps only] http://msdn.microsoft.com/en-gb/libr...=vs.85%29.aspx Process32First : Minimum supported client Windows XP [desktop apps only] http://msdn.microsoft.com/en-gb/libr...=vs.85%29.aspx Process32Next : Minimum supported client Windows XP [desktop apps only] http://msdn.microsoft.com/en-gb/libr...=vs.85%29.aspx Might be a case of "We no longer support W2K, and so now neither do you !" Thanks for the verification. EDIT: Tested on XP32, Vista32, W7-32 & also works on W2K
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th December 2012 at 05:30. |
|
|