Taskbar icon when running skl script

Asked by Saratis

I would like to be able to have a Taskbar icon show up when executing skl scripts. The reason is that I have a script that goes round in circles to assist a user with a repetitive task. I dont want the user to have to excute the script everytime. But when using this approach, the user now has to minimize everything or use alt-tab to get back to the running script. Not very elegant.

I assume this functionality can only be obtained by altering sikuli-ide.exe but I thought i'd ask anyway.

Thanks

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

Not clear, what you want to have implemented. But if you know it, just post a [feature request] bug.

Your solution, how I would implement it:

The user should start the assisted app and then doubelclick-start the .skl script.

The script first minimizes the command window, switches to the app and just starts an endless loop:

# minimize the command window
type(" ", KEY_ALT); wait(0.5); type("n") # "n" be the shortcut for Minimize in your environment

switchApp("your-app") # if needed

# start to work
while True:
   if not exists(<image-that-tells-app-is-still-running>, 0):
      popup("Seems the app is closed - script will stop")
      exit()
   if not exists(<image-that-tells-we-have-something-to-do>, 0):
      wait(1) # your decision how often it is checked
      continue
   # here comes the stuff that assists the user

The user only should know, what should be visible of the app, to keep the script running.
The exit-popup might be replaced through an input(), so the user get's a chance to rearrange things and keep the script running or just decide to finish.

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

Another idea:

leave a popup open e.g. in the upper right corner, that the user clicks to start the assistance. If the assistance is finished, the popup again waits for the next click in the upper right corner.

Since you need a picture of the popup, this might be a bit tricky to get it on Windows (no problem on Mac, since we have a screenshot feature built-in).
So you either use a screenshot tool, to make the .png, or run the .skl, that makes the popup and use Sikuli-IDE capture-hotkey (the popup has to have focus at the time of capture!).

If you succeed in capturing, this moves the popup to the upper right corner:

import thread
def waitPop():
    wait(1)
    iPop = Pattern("your-picture-of-your-popup").targetOffset(0,-45)
    # adjust targetOffset to the middle of the popup titlebar
    hover(iPop)
    movePopX = getBounds().width - int(getLastMatch().w/2)
    dragDrop(Env.getMouseLocation(), Location(movePopX, 50)) # or where ever you want

# these 3 lines make it every time you need the popup (again)
thread.start_new_thread(waitPop, ())
popup("Hallo")
switchApp("your-app")
# here comes your assistance work

This feature uses a parallel running subprocess, that moves the popup.

So your user works with the app and when it comes to the point, that script's assistance is needed he clicks <ok> in the upper right corner and off we go.

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

Should be clear:
"the 3 lines" have to be wrapped in an intelligent (knows when to finish) endless loop, as already written in my first comment.

Revision history for this message
Saratis (derkarts) said :
#4

Thanks for your elaborate replies. I will try them and report back.

My feature request would be: "Have a taskbar icon visible whilst running a sikuli script"

As I understand it you are on a Mac, but the taskbar is the equivalent of the dock.

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

Your feature request:
If you want to have it, report it as bug with title starting [request].
But it is still not clear what the advantage would be compared to the program symbol in the taskbar (guessing you mean the right part of it).

BTW: I'm not Mac only. WinXP and Win7 too. So no problem understanding you Windows guys ;-)

Always welcome.

Revision history for this message
Saratis (derkarts) said :
#6

What do you mean by "But it is still not clear what the advantage would be compared to the program symbol in the taskbar" because that is exactly what i want! When I run a skilu script from the command line, i DO NOT see a symbol in the taskbar. That was my original question!

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

Seems not to be very urgent, since it is now 4 weeks since your last action here ;-)

If you want to have additional features (still not clear what part of the taskbar your mean (left - shortcuts (guess no), middle - running programs (there is a symbol (java coffee cup) when a .skl is running, the right part - may be this is what you want)), it is only courteous to the developers, to bring up some arguments for your wanted feature and be sure to have evaluated all possibilities you have with the current version.

For other visitors it is a help, if things are clear (I'm the only one that took some time to make an attempt to help you and sort things out ;-).

So finally my suggestion again:
If you are not satisfied with my comments, just post a feature request bug and wait for the things to happen, but do not blame me for anything.

no more comments and help from my side.
have fun with Sikuli.

Revision history for this message
Saratis (derkarts) said :
#8

RaiMan, I seem to somehow have offended you. That was not my intention! Accept my apologies. I'm very happy with my answer.

The thing is, when i execute a skl file, i do not see the Coffee cup! So thats why we didnt understand eachother!

Can you help with this problem?

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

To post a message you must log in.