Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
en:vegas_python_faq [2018/10/27 17:19] hlinke |
en:vegas_python_faq [2020/03/14 16:07] (aktuell) hlinke [Section 1: General] |
||
---|---|---|---|
Zeile 99: | Zeile 99: | ||
=== Is there a way to determine the path of currently running script? === | === Is there a way to determine the path of currently running script? === | ||
- | <del>Yes, the global | + | Yes, the filename including the complete path is available in the variable |
- | Language: C# | + | |
- | String | + | So if your script needs access to a helper file that resides in the same directory, your code might look like this: |
- | String | + | |
- | This feature will be provide | + | <code Python> |
+ | clr.AddReference(" | ||
+ | import System.IO | ||
+ | from System.IO import * | ||
+ | import sys | ||
+ | scriptDirectory = Path.GetDirectoryName(sys.argv[0]) | ||
+ | helperFile = Path.Combine(scriptDirectory, | ||
+ | </code> | ||
+ | |||
+ | === How do I start a script from the commandline? | ||
+ | |||
+ | Pythonscripts can be started from the commandline together with VEGAS and commandline parameters can be passed to the script. | ||
+ | |||
+ | Example: | ||
+ | < | ||
+ | C:\Program Files\VEGAS\VEGAS Pro 16.0\vegas160.exe /SCRIPTARGS pythonscriptfilename /SCRIPTARGS arg1 /SCRIPTARGS arg2 | ||
+ | </ | ||
+ | |||
+ | * pythonscriptfilename: | ||
+ | * arg1: any text string as argument1 | ||
+ | * arg2: any text string as argument2 | ||
+ | |||
+ | The number of arguments is not limited. | ||
+ | |||
+ | The first /SCRIPTARGS must be the script filename. | ||
+ | |||
+ | Example: | ||
+ | < | ||
+ | C:\Program Files\VEGAS\VEGAS Pro 16.0\vegas160.exe /SCRIPTARGS " | ||
+ | </ | ||
+ | |||
+ | If the filename or a parameter include blanks, then the parameter must be enclosed | ||
+ | The pythonscript can access | ||
+ | This variable contains a list of strings with each argument as a separate string item in the list. | ||
+ | The first item is the scriptfilename. | ||
+ | |||
+ | The python script: | ||
+ | |||
+ | <code python> | ||
+ | for arg in sys.argv: | ||
+ | print (arg) | ||
+ | </ | ||
+ | |||
+ | gives as output: | ||
+ | |||
+ | [" | ||
=== How do I add a script to the Scripting menu? === | === How do I add a script to the Scripting menu? === | ||
Zeile 110: | Zeile 154: | ||
You can add a script to the Extension menu (under Vegas' Tools menu) by placing the script in one of the following directories: | You can add a script to the Extension menu (under Vegas' Tools menu) by placing the script in one of the following directories: | ||
- | C: | + | * C: |
- | C: | + | |
- | C: | + | |
- | C: | + | |
- | C: | + | |
- | C: | + | |
- | C: | + | |
- | You must use the subdirectoy | + | You must use the subdirectoy |
=== How do I add a script to the toolbar? === | === How do I add a script to the toolbar? === | ||
Zeile 132: | Zeile 176: | ||
You can make a custom icon appear for a script you've added to the Scripting menu or toolbar by placing a PNG image in the same folder that contains the script. The PNG file must have the same name as the script with the ' | You can make a custom icon appear for a script you've added to the Scripting menu or toolbar by placing a PNG image in the same folder that contains the script. The PNG file must have the same name as the script with the ' | ||
- | === How do create and debug a script using a Visual Studio? === | + | === How do I create and debug a script using a Visual Studio? === |
- | You can debug VEGASPython scripts usuing Microsoft Visual Studio 2017 as Editor and Debugger. You dnot have to compile the script or do any fancy stuff. | + | You can debug VEGASPython scripts usuing Microsoft Visual Studio 2017 as Editor and Debugger. You do not have to compile the script or do any fancy stuff. |
Please see the page [[en: | Please see the page [[en: | ||
Zeile 156: | Zeile 200: | ||
==== Section 2: Tracks and Events ==== | ==== Section 2: Tracks and Events ==== | ||
- | === How do access the VEGAS attributes? === | + | === How do I access the VEGAS attributes? === |
- | VEGASPython provides a variable pyVEGAS | + | VEGASPython provides a variable pyVEGAS |
Example: | Example: | ||
Zeile 283: | Zeile 327: | ||
</ | </ | ||
- | === How to I make a script modify the text string in a text event? === | + | === How do I make a script modify the text string in a text event? === |
You can't. Currently, one major shortcoming of the scripting API in VEGAS is that specific parameters of video effects are not accessible to scripts. The text string of text generators are one such parameter. Scripts can only set presets values for a given key frame. | You can't. Currently, one major shortcoming of the scripting API in VEGAS is that specific parameters of video effects are not accessible to scripts. The text string of text generators are one such parameter. Scripts can only set presets values for a given key frame. |