How to create an adjustable scrollbar to be set at variable intervals, but so far it has been having difficulties performing the separate functions

Asked by Eric Brock

I am interested in using Sikuli to create an adjustable scrollbar to be set at variable intervals, but so far it has been having difficulties performing the separate functions. The program that I am creating a script for, which simulates internal bodily functions, has a section where I must change the external environmental pressure between multiple set intervals. There is a scrollbar with the words "Lower Body External Pressure" above it. Every time that you click the arrows at the sides of the scrollbar, the blood pressure (which starts at 0mm Hg) increases or decreases by 2mm Hg. I need to be able to tell Sikuli to lower the pressure by 2mm Hg every time that it clicks on the left arrow. The problem is that Sikuli doesnt seem to be able to find the extensions that I want it to in this situation. I have it set to find the bar that says "Lower Body External Pressure", and to then find the left-pointing arrow bellow it so that every time it clicks, the external pressure will decrease by 2mm Hg.

My question then is this: Is this a simple matter of changing up the image that I have selected for Sikuli to find or do I need to do something much more complex with the code? Is Sikuli simply having trouble finding the "Lower Body External Pressure" and left-pointing arrow windows, or does it not like how I have the code entered?

Any suggestions to this problem would be greatly appreciated. Thank you for your time!

Question information

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

the relevant part of the script (copied from the .py in the .sikuli folder) and a screenshot would be helpful.

you can send it directly at my mail if needed.

Revision history for this message
Eric Brock (eric-brock21) said :
#2

thank you for your help RaiMan. I sent you an email, so let me if you received everything, otherwise I will try resending it.

Thanks!

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

got everything. I will come back soon.

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

sent you a showcase by mail.

The idea:
- capture a significant part of the scroll bar (here: the left part with both click arrows) (this img can be saved in your pic lib)
- create to patterns based on this image with the clickpoint adjusted to the left and the right arrow (values from the preview window - terget offset)
- I always adjust min similarity to a high value to find it surely
- to test before clicking, I use hover() and setShowAction(True) (same as yellow run button, but so I can control it in a script)

This may give you an idea.

One more thing:
don't switch of "exception FindFailed". use exists() instead of wait() (same functionality, returns None if find fails). This gives the script a chance, to still be interrupted if something happens, that is not expected.

Revision history for this message
Eric Brock (eric-brock21) said :
#5

This worked perfectly!! The script now does everything that I need it to. Thanks again for all your help. I will make sure to email you in the future if I have any further questions.