1. Dismiss Notice

Simulation keyboard/mouse events

Discussion in 'Tutorials' started by darkdiver, Jul 9, 2011.

  1. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    To install samples properly:

    1. Upload to the ZennoPoster.exe path 2 files Emulations.dll and Emulations.xml
    2. Open project EmulatorCS.zpproj for C# developers or EmulatorPHP.zpproj for PHP developers
    3. Replace reference to the Emulation.dll in the reference section to the new location of Emulations.dll
    4. Save and run the project, it will simulates clicks on the check boxes and simulate type in the text area.
    Emulations works only in browser window and does not work in plug ins of the browser like flash.
     

    Attached Files:

    Lankorn, SeRf*X, kvdd and 15 others like this.
  2. player

    player Client

    Joined:
    Jun 6, 2011
    Messages:
    159
    Likes Received:
    16
    thx for the tutorial

    btw, i think the CodeCreator forum is in the wrong place, because it's a part of zennoposter....
     
  3. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    off: we are thing of moving codecreator to the sub forum of the ZennoPoster.
     
  4. kikko

    kikko Client

    Joined:
    Feb 23, 2011
    Messages:
    16
    Likes Received:
    0
    The left click function does not click on any checkboxes for me, cant get it to work. The text input is working fine though. Anyone else with the same problem?
     
  5. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    It should clicks on Windows and Mac OS check boxes.
    May be some firewall (outpost for example) or anti virus filtered some messages try to disable them.
     
  6. kikko

    kikko Client

    Joined:
    Feb 23, 2011
    Messages:
    16
    Likes Received:
    0
    Tried on 3 different computers with and without firewall/anti virus, nothing happens when it is supposed to click. I am going crazy, been looking forward to this feature for over 1 month.
     
  7. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    what example are you using? PHP or C#?
     
  8. kikko

    kikko Client

    Joined:
    Feb 23, 2011
    Messages:
    16
    Likes Received:
    0
    C# but I have tried using the PHP too and it made no difference.
     
  9. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    please attach here a screen shot of the page lessons.zennolab.com/en/inputs in the code creator, may be it looks different, because click requires coordinates of the element, and click sends to the wrong place.

    This is a very simple C# code on a very simple page, test it. Do you see green message "Button Clicked"?

    PHP:
    1.     internal class Step1
    2.     {
    3.         public static int Execute(Instance instance)
    4.         {
    5.             instance.ClearCookie();
    6.  
    7.             // Go to http://zennolab.com/files/testbutton.html
    8.             Tab tb = instance.MainTab;
    9.             if ((tb.IsVoid) || (tb.IsNull)) return -1;
    10.             if (tb.IsBusy) tb.WaitDownloading();
    11.             tb.Navigate("http://zennolab.com/files/testbutton.html");
    12.             if (tb.IsBusy) tb.WaitDownloading();
    13.  
    14.             HtmlElement he;
    15.  
    16.             // Click on the button "Test Button"
    17.             he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByTag("form", 0).FindChildByAttribute("input:button", "fulltag", "input:button", "text", 0);
    18.             if (he.IsVoid) return -1;
    19.             Emulations.Emulator.LeftMouseClick(instance.MainTab.Handle, he);
    20.            
    21.             return 0;
    22.         }
    23.     }
    24.  
     
  10. Stereomike

    Stereomike Client

    Joined:
    Mar 29, 2011
    Messages:
    222
    Likes Received:
    30
    one qustion, will the free visual c# express version work with codecreator? Will it make working much more difficult?
     
  11. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    Yes, it should work. Download Visual Studio 2008 Express and try.

    No, you can use the power of visual studio with the code creator. Just launch both code creator and visual studio, and start debugging
     
    Stereomike likes this.
  12. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    I've attached updated version of Emulations.dll/Emulations.xml, it should work fine on IE8, click does not work in IE8/7 because of wrong click coordinates. We added additional information parameters to the function click coordinates.
    It is better to simulate random clicks positions near the center of the element, to avoid ban of the services.
     
  13. ImpulseHorizon

    ImpulseHorizon Client

    Joined:
    Jul 4, 2011
    Messages:
    3
    Likes Received:
    0
    Is there any support for pressing keys which don't result in typing a character? I see there's code specific to pressing the enter key " Emulator::EnterDown($instance->MainTab->Handle);". Is there any way to simulate pressing other keys, like the arrow keys?
     
  14. kikko

    kikko Client

    Joined:
    Feb 23, 2011
    Messages:
    16
    Likes Received:
    0
    The testing files are still not working, I am running Windows 7 64bit with IE8, should I down grade to IE7 or upgrade to IE9 for better results?
     
  15. crespozooo

    crespozooo Новичок

    Joined:
    Jul 30, 2011
    Messages:
    20
    Likes Received:
    23
    I'm having a problem too, everytime I try to replace Emulations.dll and save, it doesn't save.

    Anybody know something for this issue?
     
  16. diesiel

    diesiel Новичок

    Joined:
    Jul 21, 2011
    Messages:
    9
    Likes Received:
    1
    Is there any easy way for us to update our existing templates to use keystrokes/mouseclicks?
     
  17. darkdiver

    darkdiver Administrator Staff Member

    Joined:
    Jan 13, 2009
    Messages:
    2,132
    Likes Received:
    2,468
    Re download the dll and xml files. New methods for pressing arrows are added

    Try to recreate project, code creator have some bug, it will be fixed in the next release.

    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.
     
  18. shaddelick

    shaddelick Новичок

    Joined:
    Jul 25, 2011
    Messages:
    2
    Likes Received:
    0
    I am not sure how to download it to the zenno exe path... Can someone guide me? Thx

    This is for code creator, makes it a little more clearer
     
  19. shade

    shade Client

    Joined:
    Nov 19, 2010
    Messages:
    580
    Likes Received:
    337
    Maybe I misunderstood.
    Just copy Emulations.dll and Emulations.xml to the directory with ZennoPoster. For example: "C:\Program Files\ZennoLab\ZennoPoster Pro\Progs\".
     
    shaddelick likes this.
  20. shaddelick

    shaddelick Новичок

    Joined:
    Jul 25, 2011
    Messages:
    2
    Likes Received:
    0
    Yes, thats what i meant. I actually was able to figure that much after a while. I also take it the next step is to open the EmulatorCS.zpproj‎ in codemaker, then delet the Emulations.dll‎ and add the Emulations.dll‎ that i put in the zennoposter directory into the references menu. I did it up to that point. When i do this, do i just start a from that point or is there a specific way i can get it to do the key strokes... I tried to start the project after these steps and get an error saying that the project wasnt able to build... thanks
     
  21. carmamir

    carmamir Новичок

    Joined:
    Jun 22, 2011
    Messages:
    9
    Likes Received:
    0
    So for example,

    How to add emulation to imported PHP project where it choosing value from macro builder (login created randomly) ???


    I tried:

    // Executing macros
    $he->Focus();
    Emulator::SendString($instance->RiseMacros("Person.HumanLogin", array( "[Eng|4][RndNum|1970|1990]" )), true);


    But it's not working...
     
  22. shade

    shade Client

    Joined:
    Nov 19, 2010
    Messages:
    580
    Likes Received:
    337
    Of course it does not work.
    You are incorrectly set parameters.
    It should be like this:
     
  23. crespozooo

    crespozooo Новичок

    Joined:
    Jul 30, 2011
    Messages:
    20
    Likes Received:
    23
    Can you make it work on YouTube or on any website that belongs to Google? When I try registering to YT it just doesn't fill up the fields.
     
  24. bigcajones

    bigcajones Client

    Joined:
    Feb 9, 2011
    Messages:
    1,217
    Likes Received:
    666
    If you want to create an account on YT. Create an email, then sign up for Adwords. You won't ever use the Adwords account of course, but then you can sign up to YT with no problem.
     
  25. Hungry Bulldozer

    Hungry Bulldozer Moderator

    Joined:
    Jan 12, 2011
    Messages:
    3,447
    Likes Received:
    817
    First of all make focus to the element where you emulate keystrokes:
    he.Focus();
    And after clicks put
    instance.MainTab.WaitDownloading();
     
  26. shade

    shade Client

    Joined:
    Nov 19, 2010
    Messages:
    580
    Likes Received:
    337
    Hi, guys

    I see you have many questions about emulations. Ok, I made examples on C# and PHP.
    All examples work with youtube.com and fill up some fields with help Emulator on the registration page.
    I checked all examples, they work on my machine.
    You just open example on C# or PHP, remove "Emulations.dll" from references and add "Emulations.dll" from your ZP location.

    And I want to say that in IE7 it can not work.

    YouTubeEmulationCS.zpproj‎ - on C#
    YouTubeEmulationPHP.zpproj‎ - on PHP

    I hope it will help you.
     

    Attached Files:

    kvdd, kendy, bigcajones and 2 others like this.
  27. kendy

    kendy Новичок

    Joined:
    May 6, 2011
    Messages:
    18
    Likes Received:
    0
    Hi everybody !

    I have a problem with the simulation keyboard and i broke my brains for 4 days without find an anwser... :(

    I used the nice example template of Shade (youtube account) to begin to learn codecreator. I understand how simulate keybord for a specific text, but it doesn't run when i want simulate keybord to write the result of a macro (exemple : a macro who generate a password).


    i write "password" in the password field, and the simulation keyboard work very well :




    but how integrate a macro who generate a password and write it with the simulation keyboard ? :confused:

    where i need insert that ?



    Thanks for your help ^_^
     
  28. shade

    shade Client

    Joined:
    Nov 19, 2010
    Messages:
    580
    Likes Received:
    337
    Hi kendy.
    Don't worry. It's possible and very easy.

    $instanse->RiseMacros("Random.Text", array( "10", "cd" )) generates a string value.

    First: You can create a new variable to storage this value and set it instead of "password", like this:
    PHP:
    1.  
    2. $password = $instance->RiseMacros("Random.Text", array( "10", "cd" ));
    3. Emulator::SendString($instance->MainTab->Handle, $password, 100, 200);
    Second: Just set this -
    instead of "password", like this:
    PHP:
    1.  
    2. Emulator::SendString($instance->MainTab->Handle, $instance->RiseMacros("Random.Text", array( "10", "cd" )), 100, 200);
    3.  
    I have modified my examples.
     

    Attached Files:

    kendy likes this.
  29. kendy

    kendy Новичок

    Joined:
    May 6, 2011
    Messages:
    18
    Likes Received:
    0
    Thank you very very much Shade, it's work like a charm :D
     
  30. bigcajones

    bigcajones Client

    Joined:
    Feb 9, 2011
    Messages:
    1,217
    Likes Received:
    666
    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 (text):
    1. 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.
     

Пользователи просматривающие тему (Пользователей: 0, Гостей: 0)