Counter or notification pop-up

Asked by maitrey

Following is the script.
If I run the loop for 100 part numbers at a time , I need one notification window which continues shows the status of pending or completed parts (i.e. 20 of 100) in background. And which will not disturb my activities.
The same thing we can do in AutoIT but in sikulli I have searched so many blogs but could not find any relevant answers.

List = inputText("Paste Part Numbers here")
PartNumbers = List.split("\n") # split the lines in the list lines

#myListFixed = ()
for entry in PartNumbers:
    wait("1464195281868.png",150)
    click("1464195281868.png")
    type("o", KEY_CTRL)
    type(Key.TAB)
    type(Key.TAB, KeyModifier.SHIFT)
    wait(1)
    type(entry)
    type(Key.ENTER)
    if exists ("1464789404465.png"):
        click("1464789194232.png")
        click("1464789227403.png")
        continue
    popup ("select")
    type("p", KEY_CTRL)

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

sorry, but currently there is not such a feature.

The only possibility:
- run form command line
- resize/position the command line window to a suitable size/position
- use print statements instead of popup

Revision history for this message
Tom Hinds (thinds66) said :
#2

Some of my regression scripts take several hours to run, so I rely on Sikuli's Logging a lot.
  http://sikulix-2014.readthedocs.io/en/latest/scripting.html?highlight=logging

Here's how I set mine up:
    Settings.myLogFile = os.environ['USERPROFILE'] + '\desktop\Sikuli\Sikuli.log'
    logging.basicConfig(filename=Settings.myLogFile, level=logging.DEBUG, format='%(message)s', filemode='w')

Then I log a lot of activity (like 'where am I in the loop?') there, like:

  for entry in PartNumbers:
    logging.debug('- entry: ' + entry)
    do_stuff()

Then I have a custom viewer that stays on top and refreshes the contents of that log file, so I can quickly get an update on where in the process my scripts are. But you can do the same thing with PowerShell or NotePad++, etc:
  http://stackoverflow.com/questions/18632/how-to-monitor-a-text-file-in-realtime

Hope this helps,
- Tom

Revision history for this message
maitrey (maitrey-trivedi) said :
#3

Hello Tom,

The steps you suggest to follow is actually not easy.
I am eagerly waiting for that feature.

Hello Raimund and Tom,

Is there any tutorial (Stepwise) of sikulli scripts.
I actually wants to cover all the major things we need regular basis.

Thanks,
Maitrey

Revision history for this message
RaiMan (raimund-hocke) said :
#4

--- I actually wants to cover all the major things we need regular basis.
Then you have to get familiar with Python language and features.
... and with respect to the used Python interpreter: how to add Java stuff to your scripts.

Sikuli script is not a DSL like you have with AutoIT - it is just scripting in Python language.

... and Tom's clever solution is only 2 lines of code (start the logging feature) and some viewer with a customizable window size and position.

Can you help with this problem?

Provide an answer of your own, or ask maitrey for more information if necessary.

To post a message you must log in.