Can One Zenno Project call another zenno project?

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.
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
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.
 

vulkan

Client
Регистрация
14.03.2013
Сообщения
12
Благодарностей
0
Баллы
1
Thank you bigcajones!
 

usbiz

Client
Регистрация
07.02.2012
Сообщения
94
Благодарностей
0
Баллы
6
hi bigcajones
can u upload an project show how to use it?
thanks very much
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
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.
 

lupo

Client
Регистрация
28.05.2012
Сообщения
72
Благодарностей
32
Баллы
18
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.
 

zeus

Client
Регистрация
03.07.2012
Сообщения
99
Благодарностей
21
Баллы
18
Add GAC Reference to the project and select the system.xml
 
  • Спасибо
Реакции: lupo

lupo

Client
Регистрация
28.05.2012
Сообщения
72
Благодарностей
32
Баллы
18
  • Спасибо
Реакции: kamazi

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