sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #08698
Re: [Question #187432]: User Input Choices
Question #187432 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/187432
Status: Open => Answered
RaiMan proposed the following answer:
If you need the users decision, wether the script should continue at
some point of failure, than you have to ask him. This is done easiest
with input.
BTW: usage of input (with latest version rc3-r931)
input(message, default_text)
In your case "Cancel to exit script OK to continue" will be displayed in
the text entry field.
a multiline message can be done this way:
name = input("Target not found\click Cancel to exit script\nOK to continue")
--- Is there a better or more elegant way to handle this?
I am not really sure, what you mean.
Better? if you need to talk with the user, you have to do some dialog.
More elegant? In my opinion would be, if the script would be able, to recover the error situation without the user's intervention. But I do not know your app nor your error situation (besides the fact, that an image was not found.
--- using http://sikuli.org/docx/region.html#Region.setFindFailedResponse
setFindFailedResponse(PROMPT)
if not find(img): exit()
setFindFailedResponse(ABORT)
This might be something to try out. If the find fails, a message is displayed and the user is able to recover from the problem by arranging the GUI accordingly and click Retry.
The message cannot be configured, sorry - it is as it is.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.