NVil Forum

General Category => Community Help => Topic started by: rubberDuck on September 23, 2016, 12:37:14 pm

Title: Instructions.txt
Post by: rubberDuck on September 23, 2016, 12:37:14 pm
What is the syntax of instructions that are passed to NVil via instructions.txt file?
Title: Re: Instructions.txt
Post by: rubberDuck on September 23, 2016, 08:16:32 pm
Anyone?
All I need is to tell NVil to launch Clipboard Paste or Clipboard Paste (Replace) command.
Or maybe I'm misunderstanding the purpose of instructions.txt. What I assumed, is that it is used for communication between external programs and NVil.
Title: Re: Instructions.txt
Post by: samardac on September 23, 2016, 11:28:45 pm
Instruction.txt is for programers. You wrote instructions inside this file than you send to NVil special windows message, when NVil recive it, it starts to perform that instructions. It is for communication between different apps.
Is it what you are looking for?
Title: Re: Instructions.txt
Post by: rubberDuck on September 24, 2016, 12:37:37 am
Instruction.txt is for programers. You wrote instructions inside this file than you send to NVil special windows message, when NVil recive it, it starts to perform that instructions. It is for communication between different apps.
Is it what you are looking for?
This is what I'm looking for. Is there any documentation anywhere on how to issue instructions to NVil via that file?
Title: Re: Instructions.txt
Post by: samardac on September 24, 2016, 05:14:46 am
Search this forum, there is thread about it.
Title: Re: Instructions.txt
Post by: rubberDuck on September 24, 2016, 08:27:55 am
Search this forum, there is thread about it.
The problem is I already did search the forum and there isn't much about instructions.txt file. Only bits of information here and there, like some bug reports and requests regarding that file or some requests re: initialize_instructions.txt.
From what I was able to put together, I understand that the file is basically an exported composite tool. However the fact that it needs to have a .txt file extension while composite tools are in XML puzzles me.

Can you kindly point me to a thread which holds a full explanation of how to use this functionality?
Title: Re: Instructions.txt
Post by: rubberDuck on September 24, 2016, 02:39:05 pm
Okay, I get it. NVil Instructions.txt should contain Tool IDs.
Title: Re: Instructions.txt
Post by: rubberDuck on September 24, 2016, 02:54:53 pm
The file path must be like this
C:\Users\UserName\AppData\Roaming\DigitalFossils\NVil\NVil Instructions.txt
Hm... I can't get NVil to automatically read the NVil Instructions.txt file when it's placed in the %APPDATA%\DigitalFossils\NVil path. It does read it fine from NVil installation directory via File->Execute External Instruction File though. Any idea why it's stubborn when it comes to the one from %APPDATA%?
Title: Re: Instructions.txt
Post by: rubberDuck on September 24, 2016, 09:47:06 pm
I have a correct handle to NVil's window (I verified this by fiddling with ShowWindow() function), "NVil Instructions.txt" file is in "%APPDATA%\DigitalFossils\NVil" directory and contains a single command: "TID Object Shortcut Tools >> Create Box #".

With SendMessage() function I'm sending 41251, but nothing happens. What am I missing?
Title: Re: Instructions.txt
Post by: IStonia on September 25, 2016, 09:02:31 am
Try this
http://www.digitalfossils.com/Download/NVil-Sep-25-16.rar
Title: Re: Instructions.txt
Post by: rubberDuck on September 25, 2016, 11:01:16 am
Try this
http://www.digitalfossils.com/Download/NVil-Sep-25-16.rar (http://www.digitalfossils.com/Download/NVil-Sep-25-16.rar)
Now it works. Thanks!
Title: Re: Instructions.txt
Post by: rubberDuck on September 25, 2016, 11:31:49 pm
IStonia, do you think it would be problematic to implement a server that would listen to UDP or TCP communication incoming to a user-customizable port on localhost? So that we could issue commands to NVil through strings with that socket, similarly to insctructions from "NVil Instructions.txt" file? Or at least to tell NVil to read the instructions file by sending him a boolean, string or whatever?

Win32 API messages are nice, but Python version that comes with Houdini isn't compatible with pywin32 module (my guess, it was compiled with a differend VS than the DLLs of pywin32 were), so sending messages to NVil is complicated because it requires a separate CPython version to act as a catalyst (or pywin32 recompilation with the same compiler that Houdini Python was compiled with. And I have no idea which compiler was used to compile the latest Houdini's Python).

Socket communication on the other hand is supported by default in Python, so no external Python version would be necessary in order to send NVil a message.

What do you think about it?
Title: Re: Instructions.txt
Post by: IStonia on September 27, 2016, 08:34:46 am
That sounds too complicated.

Try this
http://www.digitalfossils.com/Download/NVil-Sep-27-16.rar

Instead of sending window message, you can send a text file "NVil Message_In.txt" with this content "Execute External Instruction File" to "%APPDATA%\DigitalFossils\NVil". Make sure 3DC Applink is enabled.

Title: Re: Instructions.txt
Post by: rubberDuck on September 29, 2016, 09:56:26 pm
That sounds too complicated.

Try this
http://www.digitalfossils.com/Download/NVil-Sep-27-16.rar (http://www.digitalfossils.com/Download/NVil-Sep-27-16.rar)

Instead of sending window message, you can send a text file "NVil Message_In.txt" with this content "Execute External Instruction File" to "%APPDATA%\DigitalFossils\NVil". Make sure 3DC Applink is enabled.
It's okay, IStonia. I spent the last weekend and Monday familiarizing myself with Win32 API and possible solutions to the problem with Python bundled with Houdini, and I came up with a solution. I decided to use a standalone executable that is basically one module bundled with an official distro of Python and pywin32 with its DLLs, that is launched from Houdini in a separate process, and is used to notify NVil (through SendMessage()) about updated clipboard file. Works fine, at least on my workstation. :)

I will need to look for some artists that would test the AppLink before I release it though. People who use NVil as a companion program for Houdini.
Title: Re: Instructions.txt
Post by: rubberDuck on December 19, 2017, 11:49:24 pm
If I want to pass a program executable and several arguments to it via the Launch App(*) command, how do I do it? Path to executable contains white characters (spaces):
Code: [Select]
C:\Program Files\Side Effects Software\Houdini 16.5\bin\hython.exe
So I enclose it in double quotes. I'd like to launch it with at least one parameter (the final target are two parameters), for example:
Code: [Select]
c:\users\myprofile\documents\houdini16.5\python27libs\myscript.py
It might also contain white spaces, so I also enclose it in double quotes. When I launch the composite tool, where Launch App(*) Param input string is a combination of the two:
Code: [Select]
"C:\Program Files\Side Effects Software\Houdini 16.5\bin\hython.exe" "c:\users\myprofile\documents\houdini16.5\python27libs\myscript.py"
I get File not found error, even though both paths are valid.
Title: Re: Instructions.txt
Post by: rubberDuck on December 20, 2017, 12:15:37 am
Up to now I've been using wscript.exe that launches a .vbs script which acts as a buffer for launching a .cmd (.bat) file. The latter contains the path to executable along with arguments. IIRC launching the .cmd file directly caused some problems.

But this solution is too convoluted, and that is why I'd like to simplify it and run Python with multiple arguments directly from Launch App(*).
Title: Re: Instructions.txt
Post by: IStonia on December 20, 2017, 12:45:36 am
Try this
http://www.digitalfossils.com/Download/NVil-Dec-20a-17.rar
Title: Re: Instructions.txt
Post by: rubberDuck on December 20, 2017, 01:36:22 am
Okay, the file not found error is gone, but now NVil treats Hython.exe and the .py script, which I want to pass as an argument to, as two separate executables. It launches both as separate applications. First Houdini's Python interpreter (Hython) shows up, and then Windows asks me which program should be used to launch my .py file.
Title: Re: Instructions.txt
Post by: rubberDuck on December 20, 2017, 01:38:17 am
That sounds too complicated.

Try this
http://www.digitalfossils.com/Download/NVil-Sep-27-16.rar (http://www.digitalfossils.com/Download/NVil-Sep-27-16.rar)

Instead of sending window message, you can send a text file "NVil Message_In.txt" with this content "Execute External Instruction File" to "%APPDATA%\DigitalFossils\NVil". Make sure 3DC Applink is enabled.
BTW, NVil Message_In.txt works really well. :)
Title: Re: Instructions.txt
Post by: IStonia on December 20, 2017, 02:03:47 am
Okay, the file not found error is gone, but now NVil treats Hython.exe and the .py script, which I want to pass as an argument to, as two separate executables. It launches both as separate applications. First Houdini's Python interpreter (Hython) shows up, and then Windows asks me which program should be used to launch my .py file.


Try any of these

"C:\Program Files\Side Effects Software\Houdini 16.5\bin\hython.exe"; "c:\users\myprofile\documents\houdini16.5\python27libs\myscript.py"

C:\Program Files\Side Effects Software\Houdini 16.5\bin\hython.exe; c:\users\myprofile\documents\houdini16.5\python27libs\myscript.py
Title: Re: Instructions.txt
Post by: rubberDuck on December 20, 2017, 02:13:25 am
Okay, the file not found error is gone, but now NVil treats Hython.exe and the .py script, which I want to pass as an argument to, as two separate executables. It launches both as separate applications. First Houdini's Python interpreter (Hython) shows up, and then Windows asks me which program should be used to launch my .py file.
Try any of these
"C:\Program Files\Side Effects Software\Houdini 16.5\bin\hython.exe"; "c:\users\myprofile\documents\houdini16.5\python27libs\myscript.py"
(...)
Semicolon did the trick. Thanks!