Simulation keyboard/mouse events

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
Shade, thanks so much for your help and your projects. Can you explain how to use the macros for get file and split string. In my template I have this:

Код:
he.SetValue(instance.RiseMacros("String.Split", new [] { "", "File.GetString", "\\Resources\\email.txt", "random", "false", "", ":", "0" }), true);
This is recorded while making the template, but when I run the debug, everything works okay but this. Hopefully you can help.
Hi bigcajones.

I will give a detailed explanation.

Method instance.RiseMacros takes two parameters, name of macros (for example "Person.FirstName" - it's a string value) and array of string (it's all parameters of current macros)

Macros String.Split in code look like this:
Код:
instance.RiseMacros("String.Split", new [] { "some:text", ":", "0" })
where
1. "String.Split" - it's macros name
2. new [] - it's means that will be create a new array (array of parameters)
3. {..., ..., ...} - initialization of array (all parameters have a string value and specified using a comma. Nothing else in the parameters can not be.)
4. "some:text" - it's text (string) which will be split.
5. ":" - char or string which divides text.
6. "0" - index of string which will be returned.

If you want the result of a macros passed as a parameter then you should replace this parameter on method of macros execution. For example I replaced "some:text" on
Код:
instance.RiseMacros("File.GetString", new [] { "\\Resources\\email.txt", "random", "false" })
In code it's should look like this:
Код:
instance.RiseMacros("String.Split", new [] { instance.RiseMacros("File.GetString", new [] { "\\Resources\\email.txt", "random", "false" }), "@", "0" })
instance.RiseMacros always returns a string value and you can use it for he.SetValue

Код:
he.SetValue(instance.RiseMacros("String.Split", new [] { instance.RiseMacros("File.GetString", new [] { "\\Resources\\email.txt", "random", "false" }), "@", "0" }) ,true)
I hope it's that you need.

Any questions? :az:
 
  • Спасибо
Реакции: johnblidas и bigcajones

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
For those who want to see how it looks in code:
Simple_Example.zpproj - it's my example
email.txt -text file which contains text (copy this to Resources folder from your ZP location or set correct path to this file in Simple_Example.zpproj)
 

Вложения

  • Спасибо
Реакции: johnblidas

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Thanks very much for this Shade. Not knowing an ounce of code, I appreciate your explanations and also the sample projects that you give us that actually work. Especially the YouTube one that shows us how to really use the emulations. It has helped a bunch. I'm hoping that in the new release that some of these simple problems that CC spits out will be taken care of.
 

Shayne54

Client
Регистрация
07.10.2011
Сообщения
16
Благодарностей
2
Баллы
0
I just PMed Darkdiver to hopefully get a function added to emulate Mouse Positioning for hover effects (like Youtube comments).
Hope to hear back soon.
 

limpopo

Client
Регистрация
06.07.2011
Сообщения
42
Благодарностей
2
Баллы
0
R


there is no way to emulate clicks in XML template, use Code Creator as a sub template for example, clicks in XML template will be supported in feature releases.
Ok ,so I have xml_template that signs in, grabs the my_text that I want to post, and navigates to text_form where I want my text to be typed in. And I have a code_creator_project that emulates typing a text to text_form . Haw do I "import/insert" code_creator_project to xml_template, and haw do I pass variable (my_text) to code_creator_project.?
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
I think what he is asking Shade is this. We are running a template built in XML. In ProjectMaker, how do we call our CodeCreator code into the template. So if I have a complicated XML template and I write the code for Emulations in CC, how do you make the CC code work in the XML template?

I've been wondering this myself because I have some complicated templates that would be impossible for me to create in CC right now and I would like to call emulations into the template. Could you show us maybe an example of how to do it? Maybe a small XML template that uses CC code in it?

It would be much appreciated.
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
I think what he is asking Shade is this. We are running a template built in XML. In ProjectMaker, how do we call our CodeCreator code into the template. So if I have a complicated XML template and I write the code for Emulations in CC, how do you make the CC code work in the XML template?

I've been wondering this myself because I have some complicated templates that would be impossible for me to create in CC right now and I would like to call emulations into the template. Could you show us maybe an example of how to do it? Maybe a small XML template that uses CC code in it?

It would be much appreciated.
Unfortunately, It's impossible. :(
 
  • Спасибо
Реакции: bigcajones

prosperer888

Client
Регистрация
15.09.2011
Сообщения
157
Благодарностей
4
Баллы
18
Can some make video tutorial for this ? i want to learn this :-)
 

kazhkenis

Новичок
Регистрация
23.02.2012
Сообщения
8
Благодарностей
0
Баллы
0
Hi guys!
I started using CodeCreator but I have one big problem. The file upload doesn't work... it opens Browse window but doesn't write/choose anything. I tried to make it using the same strategy as I was using in ProjectMaker:
1. Press RMB on the file input field
2. Press set value > With the help of macros
3. Write macro

This strategy works perfectly when using templates but fails using codecreator.
The output code looks like this:

// Setting value [{-Director...] to the element with tag [input:file]
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByTag("form", 3)->FindChildByName("img");
if ($he->IsVoid) {
$he = $instance->GetTabByAddress("page")->GetDocumentByAddress("0")->FindElementByTag("form", 3)->FindChildByAttribute("input:file", "fulltag", "input:file", "text", 0);
}
if ($he->IsVoid) return -1;

// Executing macros
$he->SetValue($instance->RiseMacros("Directory.RandomFile", array( "\Resources\images" )), true);
Thank you for help.
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
Hi guys!
I started using CodeCreator but I have one big problem. The file upload doesn't work... it opens Browse window but doesn't write/choose anything. I tried to make it using the same strategy as I was using in ProjectMaker:
1. Press RMB on the file input field
2. Press set value > With the help of macros
3. Write macro

This strategy works perfectly when using templates but fails using codecreator.
The output code looks like this:



Thank you for help.
The file upload doesn't work in debug time in CC. But the same code will be work fine in ZP.
 

kazhkenis

Новичок
Регистрация
23.02.2012
Сообщения
8
Благодарностей
0
Баллы
0
OK, the file upload works in ZennoPoster. Thanks for that.
The problem I am facing now is that MouseClick Emulation doesn't work in ZP. While debugging it works just fine but when run with ZP it does the same as RiseEvent "click" which is not what I need.
Is it possible to press on exact coordinates? And how should I find out what are coordinates of the button?

Thank you!
 

mantra

Client
Регистрация
11.05.2012
Сообщения
7
Благодарностей
0
Баллы
0
Emulation works great until the instance window is on top, running instance window minimized emulation not works on windows 7.

How to set instance window always on top, disable minimized option?
 

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