Execute command line with TVP Topic is solved
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Execute command line with TVP
Hey,
Could only find ways of executing a script in TVP from the command line.
Is there a way to execute a command line from within TVP?
Could only find ways of executing a script in TVP from the command line.
Is there a way to execute a command line from within TVP?
Re: Execute command line with TVP
I'm not sure to understand what's you're exactly looking for,tokejepsen wrote:...
Is there a way to execute a command line from within TVP?
but you can embed any script command in a custom button,
then assign this button (the embedded command) to a shortkey,
you also have a special command to launch a longer script :
Code: Select all
tv_runscript myscript.grg
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
Thanks ZigOtto:)
Don't know why I didn't try batch scripts, but it works!
Now the question is how to pass arguments to the batch script. Either of these two work;
If this is not possible, then I'll just write a temporary batch file and execute that.
Don't know why I didn't try batch scripts, but it works!
Code: Select all
tv_runscript "myBatch.bat"
Code: Select all
tv_runscript "myBatch.bat" --data key1 value1
Code: Select all
tv_runscript "myBatch.bat --data key1 value1"
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
I tried exploring writing a bat file out, but I can't get this to work;
On startup TVP asks to the "Write to file", but executing more times and nothing happens. It also doesn't actually write the file.
Has anyone used "tv_WriteTextFile" successfully?
Code: Select all
tv_WriteTextFile "C:/Users/toke.jepsen/Desktop/temp.txt" "Line to write"
Has anyone used "tv_WriteTextFile" successfully?
Re: Execute command line with TVP
afaik, (tv_WriteUserString and tv_ReadUserString work as expected,
they are used in many scripts from the content sharing section,
to store and retrieve tvpaint data (text or values) from one session to the other, these 2 commands require "Section" and "Argument" parameters, to indicate precisely where to write/read the text file within the config file,
they are used in many scripts from the content sharing section,
to store and retrieve tvpaint data (text or values) from one session to the other, these 2 commands require "Section" and "Argument" parameters, to indicate precisely where to write/read the text file within the config file,
Writes a character string to the current configuration file. The section argument is the name of the section, and the line argument is the name of the line in which the text string is to be written. These arguments must be surrounded by double quotes. This command is used to store variables between two working sessions using George and TVPaint and to read them using tv_ReadUserString. (However take care not to put too many character strings into the configuration file).Code: Select all
tv_WriteUserString section line text
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
Thanks ZigOtto:)
I've used and successfully. The problem is writing out a file to disk with .
I've used
Code: Select all
tv_WriteUserString
Code: Select all
tv_ReadUserString
Code: Select all
tv_WriteTextFile
Re: Execute command line with TVP
tokejepsen wrote:I tried exploring writing a bat file out, but I can't get this to work;
On startup TVP asks to the "Write to file", but executing more times and nothing happens. It also doesn't actually write the file.Code: Select all
tv_WriteTextFile "C:/Users/toke.jepsen/Desktop/temp.txt" "Line to write"
Has anyone used "tv_WriteTextFile" successfully?
You forgot "Create"
This code will work
Code: Select all
Param none
tv_writetextfile "Create" "C:\test\test.txt" "Hello World"
http://wiki.tvpaint.fr/index.php?title=Tv_WriteTextFile" onclick="window.open(this.href);return false;
I dont think there is a way to execute Command line directly in TVPaint. Is there Developers?
It could be handy I would use it.
I have a small script in Python than looks in a folder. Then I can write a text file from TVpaint in this folder the python script will notice and execute the command
http://timgolden.me.uk/python/win32_how ... anges.html" onclick="window.open(this.href);return false;
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
Thank you Mads:)
That worked a treat!
So what I'm having a some trouble with now, is how to write double quotation marks. The current workflow is to write a temporary bat file, and run it. This way I can add arguments to the bat file and "tv_runscript" to run the bat file.
I'm passing in the original bat file, I want to execute with some arguments from a user string, and the destination path for the temporary bat file;
What I can't seem to get working is how to write double quotation marks around the path to the original bat file. Anyone got an insight on this?
That worked a treat!
So what I'm having a some trouble with now, is how to write double quotation marks. The current workflow is to write a temporary bat file, and run it. This way I can add arguments to the bat file and "tv_runscript" to run the bat file.
I'm passing in the original bat file, I want to execute with some arguments from a user string, and the destination path for the temporary bat file;
Code: Select all
tv_ReadUserString pyblish script
PARSE result pyblishScript
tv_ReadUserString pyblish path
PARSE result pyblishPath
script = pyblishScript' --data key1 value1'
tv_WriteTextFile "Create" '"'pyblishPath'"' script
tv_runscript pyblishPath
tv_WriteTextFile "Remove" '"'pyblishPath'"'
Re: Execute command line with TVP
Pretty clever to run a .bat file with tv_runScript I didn't knoe it could do this . I only thought it would rum George Scripts. Maybe it also could run Python Scripts?
I can't male it work either . Maybe the developers can help?tokejepsen wrote: What I can't seem to get working is how to write double quotation marks around the path to the original bat file. Anyone got an insight on this?
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
You probably could, else you could run a bat file that runs the python script:)Maybe it also could run Python Scripts?
Re: Execute command line with TVP
try first setting quotes around path and filename in a variable:tokejepsen wrote:What I can't seem to get working is how to write double quotation marks around the path to the original bat file. Anyone got an insight on this?Code: Select all
tv_ReadUserString pyblish script PARSE result pyblishScript tv_ReadUserString pyblish path PARSE result pyblishPath script = pyblishScript' --data key1 value1' tv_WriteTextFile "Create" '"'pyblishPath'"' script tv_runscript pyblishPath tv_WriteTextFile "Remove" '"'pyblishPath'"'
Code: Select all
PathFileName = CONCAT(pyblishPath,pyblishScript)
PathFileName = '"'PathFileName'"' // apply quotes here
tv_warn PathFileName // check that the path and filename are contained in quotes as you want it...
tv_WriteTextFile "Create" PathFileName Script
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
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
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
Thanks Sven:)
I tried setting the quotation marks before, but it just seems to ignore it when writing to disk. Here a test case;
It prints the quotation marks, but TVP doesn't write the quotation marks to the text file.
I tried setting the quotation marks before, but it just seems to ignore it when writing to disk. Here a test case;
Code: Select all
script = 'somethingInQuotes'
script = '"'script'"'
PRINT script
tv_WriteTextFile "Create" "C:\Users\toke.jepsen\Desktop\temp.txt" script
Re: Execute command line with TVP
Try this ?
But I think it can be problematic if you want to write single-quote AND double-quotes with the same command.
Code: Select all
script = 'xxx bla"bla"bla xx'
PRINT script
tv_WriteTextFile "Create" "C:\Users\toke.jepsen\Desktop\temp.txt" script
TVPaint Team
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
Thanks Mike:)
Your code works, but the problem is when you have the quotation marks at the beginning of the string;
Your code works, but the problem is when you have the quotation marks at the beginning of the string;
Code: Select all
script = '"bla" bla xx'
PRINT script
tv_WriteTextFile "Create" "C:\Users\toke.jepsen\Desktop\temp.txt" script
-
- Posts: 19
- Joined: 20 Aug 2015, 12:41
Re: Execute command line with TVP
More to this. The problem actually seems to be with whitespace before or after the quotation marks.
Code: Select all
script = 'xxx bla "bla"bla xx'
PRINT script
tv_WriteTextFile "Create" "C:\Users\toke.jepsen\Desktop\temp.txt" script