Simulation keyboard/mouse events

shade

Client
Joined
Nov 19, 2010
Messages
580
Reaction score
346
Points
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:

Code:
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:
Code:
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
Code:
instance.RiseMacros("File.GetString", new [] { "\\Resources\\email.txt", "random", "false" })
In code it's should look like this:
Code:
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

Code:
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:
 

shade

Client
Joined
Nov 19, 2010
Messages
580
Reaction score
346
Points
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)
 

Attachments

  • Thank you
Reactions: johnblidas

bigcajones

Client
Joined
Feb 9, 2011
Messages
1,216
Reaction score
684
Points
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
Joined
Oct 7, 2011
Messages
16
Reaction score
2
Points
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
Joined
Jul 6, 2011
Messages
42
Reaction score
2
Points
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
Joined
Nov 19, 2010
Messages
580
Reaction score
346
Points
63

bigcajones

Client
Joined
Feb 9, 2011
Messages
1,216
Reaction score
684
Points
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
Joined
Nov 19, 2010
Messages
580
Reaction score
346
Points
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. :(
 
  • Thank you
Reactions: bigcajones

prosperer888

Client
Joined
Sep 15, 2011
Messages
157
Reaction score
4
Points
18
Can some make video tutorial for this ? i want to learn this :-)
 

kazhkenis

Новичок
Joined
Feb 23, 2012
Messages
8
Reaction score
0
Points
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
Joined
Nov 19, 2010
Messages
580
Reaction score
346
Points
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

Новичок
Joined
Feb 23, 2012
Messages
8
Reaction score
0
Points
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
Joined
May 11, 2012
Messages
7
Reaction score
0
Points
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?
 

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)