app.focus()-need asistance

Asked by muni

iam working on sikuli to automate few checks.While presenting my screen via skype to others app focus is being pushed to back as there would be a top bar saying presenting your screen though i use the function app.focus correctly.
it is a screen presentation.
could you please help us here.
The code is as follows in Python

itracapp.focus('iTrac Dashboard')
while exists(Pattern("1582814114669-3.png").similar(0.81)):
    itracapp.focus('Error -9')
    wait(2)
    #
    where = Region(525,488,733,241)
    result = Do.popError("", "Unable to Launch the dashboard-retsrate is required", "", False, 3)
    click("1582821885318-3.png")
    wait(2)
    click(Pattern("1582821934102-3.png").similar(0.87))
    wait(1)

Question information

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

itracapp.focus('iTrac Dashboard')
### what is itracapp?
### someApp.focus(someText) is not defined
### either App.focus(text) or someApp.focus()

while exists(Pattern("1582814114669-3.png").similar(0.81)):
    itracapp.focus('Error -9')
    ### see above

    wait(2)
    #
    where = Region(525,488,733,241)
    ### never used ??

    result = Do.popError("", "Unable to Launch the dashboard-retsrate is required", "", False, 3)
    # why is this an error here?

    click("1582821885318-3.png")
    wait(2)
    click(Pattern("1582821934102-3.png").similar(0.87))
    wait(1)

the logic of your workflow is not evident, sorry.

Generally: any action on the screen, while a script is running, can steal the focus. So take care, that nothing else happens on your system, that is not controlled by the script.

Revision history for this message
muni (rajeshmuni) said :
#2

well iam using aremote desktop connect and on top of that i presenting my screen to others for a demo to show how the automation works.
so there are 3 layers
itrac app =some app

below is the full code:

itracapp = App(r'C:\Program Files (x86)\Deutsche Bank\Autobahn Toolbar (UAT)\AutobahnBootstrapper.exe')
itracapp.open()
itracapp.focus()
searchbar = exists("1583244105302-2.png")
if exists("1583244105302-2.png"):
    click("1583244159790-2.png")
    type('itrac dashboard'+ Key.ENTER)
else:

    wait("toolbar3-2.png",60)
    wait(2)
    appicon=findAll(Pattern("1582824632346-3.png").similar(0.82))

    click(Pattern("1582730255577-3.png").targetOffset(-1,-5))
    wait(2)

    wait(Pattern("1582730978402-3.png").similar(0.86),10)

#def startitrac():
    searchbar = find(Pattern("1582730978402-3.png").similar(0.85))

    click(Pattern("1582730978402-3.png").similar(0.85).targetOffset(-94,1))
    type('itrac dashboard'+ Key.ENTER)
    #wait(13)
where = Region(0,0,546,303)
launcherissue = exists(Pattern("1582814114669-3.png").similar(0.81),15)
itracapp.focus('iTrac Dashboard')
while exists(Pattern("1582814114669-3.png").similar(0.81)):
    itracapp.focus("Autobahn")
    wait(2)
    #
    where = Region(525,488,733,241)
    result = Do.popError("", "Unable to Launch the dashboard-retsrate is required", "", False, 3)
    click("1582821885318-3.png")
    wait(2)
    click(Pattern("1582821934102-3.png").similar(0.87))
    wait(1)

Revision history for this message
muni (rajeshmuni) said :
#3

while exists(Pattern("1582814114669-3.png")
the above image keep on blinks

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

I do not understand:
the above image keep on blinks.

... and my comments from #1 are still valid and not answered.

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.