SDK doesn't let me "loadImage" with spaces in path-name, ..on windows

A forum dedicated to George scripting questions
Post Reply
User avatar
kaspar128
Posts: 20
Joined: 12 Feb 2013, 15:18
Location: Amsterdam

SDK doesn't let me "loadImage" with spaces in path-name, ..on windows

Post by kaspar128 »

I am creating a plugin, with the SDK, to load images:
On linux it works fine, but apparantly, on windows I have to encapsulate my path-string with `'"'` (single-double-single-quotes)
But! ..also, because on windows, I have to encapsulate my path with double-quotes first, (because of the `:`)

I tried almost every form of escaping but I cannot get it to work on windows. Is the a special escaping-sequence I should use on windows, for the `TVSendCmd`?

Here is an example of how I try it. (the cmd string comes from outside normally). I would like to know how the escaping in the `cmd`-string should be

Code: Select all

                   
...                                 
char result[4096] = {0};
char *cmd = "tv_LoadImage '\"'\"P:/path with spaces/image.png\"'\"' stretch"
int ret = TVSendCmd(iFilter, cmd, result);   
PS, also when I run this string in TVPaint, under a custom-action as an embedded george-command, this will run fine:

Code: Select all

tv_LoadImage '"'"P:/path with spaces/image.png"'"' stretch
So yes, I'm really puzzling for the right escaping-sequence.. If anyone has the answer, then thanks in advance!!
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: SDK doesn't let me "loadImage" with spaces in path-name, ..on windows

Post by Svengali »

You can do it in three steps:
1. Store your drive,path,filename,extension in a string variable...
PathImage = "C:\Program Files\TVPaint Developpement\TVPaint Animation 11 Pro (64bits)\Images\ShowMe01.jpg"

2. Enclose the string variable in single+double+single quotes...
PathImage = '"'PathImage'"'

3. Load the image to the current frame...
tv_LoadImage PathImage

===================================================================
You can also do it in a two step operation, first enclose the PathImage string, then load it...
1. PathImage = '"' "C:\Program Files\TVPaint Developpement\TVPaint Animation 11 Pro (64bits)\Images\ShowMe01.jpg" '"'

2. tv_LoadImage PathImage

====================================================================
You can also, do it all on the same line in one combined operation: call the LoadImage command, while surrounding the PathImage string in double quotes, and surrounding that with single+double+single quotes

1. tv_LoadImage '"' "C:\Program Files\TVPaint Developpement\TVPaint Animation 11 Pro (64bits)\Images\ShowMe01.png" '"'

=====================================================================

EDIT: Looking again at your question, it seems that you want to know about the tv_cmd and how that is combined with the tv_LoadImage command (with proper quotation marks)?

So. This seems to work for me:
1. PathImage = '"' "C:\Program Files\TVPaint Developpement\TVPaint Animation 11 Pro (64bits)\Images\ShowMe01.jpg" '"'
2. tv_cmd SELECTION tv_LoadImage PathImage

You can substitute any one of the control parameters where the SELECTION parameter appears in step two.
IMAGE | SELECTION | HEADS | EXPOSURES | LAYERHEADS | LAYER

If you are trying to load different images to different frames, you'll probably have to use a more structured, multiline script beyond the tv_cmd method, but I have no way of knowing what it is you are actually trying to do.

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
Post Reply