Comment 6 for bug 1434434

Revision history for this message
Brian Redmond (bredmond) wrote : Re: [Bug 1434434] Re: [request] want a workflow recording tool with support for runtime adjustments to the workflow

Hi everyone, this is simple, but might be helpful. I wrote this to speed
up image capture for myself. This uses Sikuli itself to prompt for a
region of interest on the screen and then automatically capture a new image
every time the region changes (think of it as motion detected screen
capture). Then you have a folder of timestamped images you can rename and
use. Great for automating things like installers.

from os import (
     makedirs,
     rename,
)
from time import strftime

from sikuli.Sikuli import *

script_capture_path = getBundlePath()

try:
    makedirs(script_capture_path)
except OSError:
      pass
#watch_area = SCREEN
watch_area = selectRegion()
permanent_image_name ="%s/%s.png" % (script_capture_path,
                                     strftime("%a %Hh%Mm%Ss"))
rename(capture(watch_area), permanent_image_name)

while True:
    try:
        wait(Pattern(permanent_image_name).similar(.99), 1)
    except FindFailed:
        permanent_image_name ="%s/%s.png" % (script_capture_path,
                                             strftime("%a %Hh%Mm%Ss"))
        rename(capture(watch_area), permanent_image_name)

On Tue, Mar 24, 2015 at 10:32 AM, RaiMan <email address hidden> wrote:

> @Eugene
> yep, that is the main line to follow.
>
> My idea is to generally use keys to tell the recorder what to do:
> e.g. ctrl-alt-action, where action could be
> c for click
> d for double click
> r for right click
> m for a complex mouse action (configured on the fly)
> t for type
> p for paste
> s for a configurable wheel action (scroll)
> w for a wait on this image
> v to wait for the image to vanish
> ….
> this is accompanied by some floating palettes with situation dependent
> content.
> so the user would just move the mouse to the next place and press the
> relevant key.
>
> I am watching a promising Java library, that allows to intercept
> keyboard and mouse actions at the system level, so this would not need
> any hotkey usage.
>
> Going this way, we will not have any problems with visually changing
> elements, since the recorder can:
> - move the mouse away and capture the inactive state
> - move the mouse back and capture the active state
> if the user signals, that it is a vivid element (or it might even be
> checked automatically - only some 10 milliseconds)
>
> the recorder outcome will be some meta (I guess I will use YAML), that
> can be edited and saved.
>
> You might get it as Python, Ruby, JavaScript or Java code (other
> translators can be added/contributed), to use it in your script or if
> sufficient, just run it as is. (This is similar to what Selenium
> offers).
>
> After a workflow snippet is recorded, one might run it in the recorder
> to automatically add some timing parameters like max waiting times.
>
> --
> You received this bug notification because you are subscribed to Sikuli.
> https://bugs.launchpad.net/bugs/1434434
>
> Title:
> [request] want a workflow recording tool with support for runtime
> adjustments to the workflow
>
> Status in Sikuli:
> In Progress
>
> Bug description:
> Hi guys!
>
> @RaiMan, could you kindly advise me if you have done a script
> recording tool? If you haven't, would you be interested in my one? It
> some kind of floating panel with two buttons Record and Stop, that can
> capture pictures and write your typing. Output is simply set of
> commands, for example:
>
> s.click("c:\\tmp\\myimgs\\PREF_20150320130001.PNG");
> s.type("H");
> s.type("e");
> s.type("l");
> s.type("l");
> s.type("o");
> s.type(" ");
> s.type("g");
> s.type("u");
> s.type("y");
> s.type("s");
> s.type("!");
> s.type(Key.ENTER);
>
> You can copy them and past to your code. Probably, I or someone else
> could develop a plugin for eclipse in the future that will input the
> commands directly to your code. By now, it will be an AWT application.
> The main advantage of the tool is to reduce necessity to make pictures
> manually and link them to the commands, the tool does it for you.
>
> I could also make an youtube video. So, let me know if you need so.
>
> Thanks!
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/sikuli/+bug/1434434/+subscriptions
>