Hello
How i can make a separate Thread from inside Ventuz (i.e. in my Ventuz Script node). I need read data from Excel (many difference data so workbook node isn't suited). If does it without separate Thread the Scene is hanging. Here is my code:
public bool OnUpdate(int arg)
{
Thread ExcelThread = new Thread(new ThreadStart(this.MyThread));
ExcelThread.Start();
return false;
}
public void MyThread()
{
try
{
app = new Excel.Application();
Update_Info = "OK";
s = "AlbumInit";
AlbumInit();
s = "ReadConfig";
ReadConfig();
s = "LoadItems";
LoadItems();
s = "Output_Current_Upgrade";
Output_Current_Upgrade();
test_size = "photo: " + Photo.AlbumQnt.ToString() + "video: " + Video.AlbumQnt.ToString() + "mesh: " + Mesh.AlbumQnt.ToString() + "audio: " + Audio.AlbumQnt.ToString();
changed = true;
s = "finish";
}
catch
{
Update_Info = "There are some errors";
}
finally
{
app.Quit();
app = null;
book = null;
sheets = null;
sheet = null;
cell = null;
}
}
Methods MyThread( ) and OnUpdate( ) ReadConfig( ) etc are members of Script class. Functions like ReadConfig( ), LoadItems( ) are my function which is worked well. In the issue Ventuz has crashed with: (System.NullReferenceException) in "Ventuz.exe [8296]".
Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
Multiple Threads
Moderator: Support
- Ralf Stanke
- Posts: 11
- Joined: 10 Jan 2012, 12:03
Re: Multiple Threads
Hi, I can't realy say what is wrong in your script - so I'm just guessing:
Ralf
- Ensure that you do not update any script properties from that extra thread. Store the actual results in member varibales and mark them as NEW. The GenerateValues method should see the updated data and transfer it to the output properties in the main thread. (don't forget to return true, to let Ventuz know about the new values)
- Try to enabled the Debugging mode to figure out what goes wrong. See user manual (you'll need a Visual Studio installed)
http://www.ventuz.com/support/help/late ... alDebugger
Ralf
Re: Multiple Threads
Hi,
for exel stuff I use a this:
http://www.gemboxsoftware.com/spreadsheet/free-version
The free version of a C# library, very useful. May be it help.
greatings
for exel stuff I use a this:
http://www.gemboxsoftware.com/spreadsheet/free-version
The free version of a C# library, very useful. May be it help.
greatings
3DJo - [Ventuz] freelancer and trainer
Re: Multiple Threads
For exel stuff I use this:
http://www.gemboxsoftware.com/spreadsheet/free-version
Nice free C# library
joschy
http://www.gemboxsoftware.com/spreadsheet/free-version
Nice free C# library
joschy
3DJo - [Ventuz] freelancer and trainer
Re: Multiple Threads
Big thanks!!!
The problem was I updated Script properties:) I deleted line "changed = true;" from end of TRY block in MyThread() and it got worked. But now i dont undestand why?? Inside my Output_Current_Upgrade() function i have line "changed = true;". Does Ventuz ignore it???
Sorry maybe it is foolish questions but: (1) How "mark them as NEW"???
(2)How call the "GenerateValues method"?
The problem was I updated Script properties:) I deleted line "changed = true;" from end of TRY block in MyThread() and it got worked. But now i dont undestand why?? Inside my Output_Current_Upgrade() function i have line "changed = true;". Does Ventuz ignore it???
Sorry maybe it is foolish questions but: (1) How "mark them as NEW"???
(2)How call the "GenerateValues method"?