Can One Zenno Project call another zenno project?

  • Автор темы Автор темы vulkan
  • Дата начала Дата начала

vulkan

Client
Регистрация
14.03.2013
Сообщения
12
Реакции
0
Баллы
1
just wondering if its possible if I have one main codecreator or project maker project calling other project.

I mean if I have:
example1.zpproj
example2.zpproj
example3.zpproj
main.zpproj

main.zpproj will be my main zennoposter loadfile and will just have to call/having a script calling example1..2..3.proj to run if needed.
Is this possible? How will I execute this.

Thanks.
 
Sure you can do it with c# code.

Код:
Развернуть Свернуть Копировать
var searchName = "example1";
var searchResult = false;

// get the task list from the ZennoPoster
var tasks = ZennoPoster.TasksList;
foreach (var tsk in tasks)
{
	// loading Xml documnt with task content
    var doc = new System.Xml.XmlDocument();
    doc.LoadXml("<Task>" + tsk + "</Task>");

    // Search task by name
    var nameElement = doc.SelectSingleNode("Task/Name");
    if(nameElement == null) continue;
    var name = nameElement.InnerText;
    // if we found our task
    if (name == searchName)
    {
        // take task id
        var idElement = doc.SelectSingleNode("Task/Id");
        if (idElement == null) continue;
        var id = Guid.Parse(idElement.InnerText);

		// take execution settings element
        var esElement = doc.SelectSingleNode("Task/ExecutionSettings");
        if (esElement == null) continue;

		// take limit of threads of the task
        var threadsElement = doc.SelectSingleNode("Task/ExecutionSettings/LimitOfThreads");
        if (threadsElement == null) continue;
		
		// change the value
        threadsElement.InnerText = "5";

		// set new settings
        ZennoPoster.SetExecutionSettings(id, esElement.InnerXml);
		
		{
			// take execution settings element
        var esElement1 = doc.SelectSingleNode("Task/ExecutionSettings");
        if (esElement1 == null) continue;

		// take limit of threads of the task
        var threadsElement1 = doc.SelectSingleNode("Task/ExecutionSettings/NumberOfTries");
        if (threadsElement1 == null) continue;
		
		// change the value
        threadsElement1.InnerText = project.Variables["rowCount"].Value;

		// set new settings
        ZennoPoster.SetExecutionSettings(id, esElement1.InnerXml);
		}
		
		
        searchResult = true;
        break;
    }
}
if (!searchResult)
	throw new Exception("Task " + searchName + " not found!");

This code will set the number of threads for template example1 to 5 and will set the number of executions to the project variable "rowCount" that is grabbed from the template.
 
Thank you bigcajones!
 
hi bigcajones
can u upload an project show how to use it?
thanks very much
 
hi bigcajones
can u upload an project show how to use it?
thanks very much
You can create the task in ZennoPoster and save the settings. In your project (via Own Code C#) you just load this settings as string or xml document and call the AddTask method.
And of course you should call the StartTask method. The guid of task you get from the task settings.
 
Hello ZennoPoster Hackers & C# coders!
I have one problem with the example posted from bigcajones.
As I understand the example I need to have 2 sample projects, the first one have the {-Variable.rowCount-} and this ZennoPoster project is starting the second project with the name example1.

The problem is that I receive this Error when testing the C# code or execute the project in ZennoPoster:
"The type or namespace name 'XmlDocument' does not exist in the namespace 'System.Xml' (are you missing an assembly reference?)". [Строка: 9; Cтолбец: 30]





Посмотреть вложение Start-a-project-from-project.rar

As you can see in the project I use also OwnCodeUsing
Код:
Развернуть Свернуть Копировать
using System;
using System.Xml;
but the Error is the same ...

Reading google search about similar problems here I tested it with the type XDocument but with the same Error.
 
Add GAC Reference to the project and select the system.xml
 
  • Спасибо
Реакции: lupo

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)