Running a Batch or Python Script from TVPaint? Topic is solved

A forum dedicated to George scripting questions
Post Reply
blastframe
Posts: 8
Joined: 29 May 2016, 17:44

Running a Batch or Python Script from TVPaint?

Post by blastframe »

Hello,
Is it possible to run a Windows Batch or Python Script from TVPaint?

I have tried tv_ReadUserString and tv_ReqFile, but to no avail.

Thanks!
Last edited by blastframe on 25 Oct 2019, 00:05, edited 1 time in total.
Svengali
Posts: 1552
Joined: 28 Dec 2006, 10:08

Re: Running a Batch Script from TVPaint?

Post by Svengali »

Have you tried:

Code: Select all

tv_plugin iFile "mount"|"open"|"cmd"|"exec"|"about" [iParameters]

Execute a plugin

[PARAMETERS]
iFile                                  filesystempath    The plugin
                                                         Info:
                                                         For path with special characters (like ':'), you need to write
                                                             (to not manage the string as a variable)
                                                             tv_***** ... "c:/Users/Mike/Desktop/myfile.ext" ...
                                                         For path with spaces, you need to write:
                                                             (to manage the path as a single string inside TVPaint Animation)
                                                             tv_***** ... '"'"c:/Users/Mike/Desktop/my file with spaces.ext"'"' ...
                                                             The path (already encapsulated with quote (") is again encapsulated with:
                                                             simple-quote (') quote (") simple-quote (')
"mount"|"open"|"cmd"|"exec"|"about"    enum              The command to call in the plugin
iParameters                            string            The parameters of the command for 'cmd' and 'exec'

[RETURN]
oResult    int    The result status returned by the plugin for each command
sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
blastframe
Posts: 8
Joined: 29 May 2016, 17:44

Re: Running a Batch Script from TVPaint?

Post by blastframe »

Hi Sven,
This seems like a step in the right direction, thank you. I am getting an error from TVPaint however.

Here is my batch file, HelloWorld.bat, that works in Command Prompt:

Code: Select all

ECHO OFF
ECHO Hello World
PAUSE
This is my TVPaint George script:

Code: Select all

tv_plugin "C:/Users/Kevin/Desktop/HelloWorld.bat" open
And this is TVPaint's error message when I run it:
Hello_World_error.png
Hello_World_error.png (11.18 KiB) Viewed 2030 times
"C:/Users/Kevin/Desktop/HelloWorld.bat is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support. Error status 0xc000012f"

EDIT: I have looked into this and the only examples I could find were using TVPaint's .dll extension files as plugins. If anyone knows if running a script is possible, please let me know!
Svengali
Posts: 1552
Joined: 28 Dec 2006, 10:08

Re: Running a Batch or Python Script from TVPaint?

Post by Svengali »

Here are three forum links to discussions which might help:

Executing Command Line

Using Python and FFMPEG

Python Scripting

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
blastframe
Posts: 8
Joined: 29 May 2016, 17:44

Re: Running a Batch or Python Script from TVPaint?

Post by blastframe »

You've been very helpful, Sven, thank you.

The first forum link had a very useful snippet (I saw your input on that thread as well :D ):

Code: Select all

tv_runscript "C:/Users/Kevin/Desktop/HelloWorld.bat"
The other two forum links talked about using Python, but neither explained how to run Python from TVPaint.

Thanks again, Sven, for the help!
Svengali
Posts: 1552
Joined: 28 Dec 2006, 10:08

Re: Running a Batch or Python Script from TVPaint?

Post by Svengali »

:D

When you distill the best TVPaint/GEORGE solution for your purposes, could you take a few minutes to add a summary that demonstrates what you were trying to do and how you solved it, to this thread, for other script writers? THANKS!

sven
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Gary
Posts: 26
Joined: 12 May 2015, 13:33

Re: Running a Batch or Python Script from TVPaint?

Post by Gary »

This might not work for your purpose, but I've had better luck doing this the other way around.

I have Python scripts that run George scripts instead. That way I can wrap Python code before and after the George script runs. You can run george commands in the Windows commandline by basically calling the TVPaint path and then passing either George commands or scripts as arguments.

eg. "C:/Path/To/TVPaint.exe" "cmd=tv_WriteUserString DeadlineConfig ExportFormat PNG"
eg. "C:/Path/To/TVPaint.exe" "script=C:\Path\To\GeorgeScript.grg"

If that sounds like it could be helpful, I can elaborate further on how it works. But it's been the most reliable way to communicate back and forth with TVPaint and Python.
Post Reply