
My problem was to differ popups with a similar title of each other. I did this with strings which were typical for the searched popup. But somehow it recognizes always the same popup with the string "will be cut off" in it. First I thought it does not work in this way, because the wrong answer was the first. But after exchanging the check it still doesn't work.
Don't bother about the code, it is a slightly modified copy of the same commands, so the basic routine is simple and there are many comments, so it is grown to 100 lines.
I made another comprimised version which is below, only with commands and without comments, which is half the length
//sets the loopvalue to 0
let>popuploop=0
//Start of the Popup-detection-Loop
Label>popups
//sets the values of the variables to 1
let>timeout=1
let>flash=1
let>ident=1
let>hardware=1
let>cutoff=1
//set focus to HMI
setfocus>HMI600*
//if window "Test configuration time" is open, goto check off
IfWindowOpen>Test configuration time,configtime
//Detect if another Popup is open
IfWindowOpen>HMI600
//Gets the text of the popup (GetWindowText>WINDOWTITLE,RESULT_VARIABLE)
GetWindowText>HMI600,popup
//Lower the string to prevent failures
Let>popup={Lower(%popup%)}
//Returns the absolut Position of the start of a substring in a string
//position>"KEYWORD",%STRING%,START_POSITION,RESULT_VARIABLE,FALSE=ABSOLUTE_RESULT
position>"nonvolantile flash memory",%popup%,1,flash,FALSE
//check for timeout and goto close popup if it is contained
if>flash>0,closeflash
//Returns the absolut position of the start of a substring in a string
//position>"KEYWORD",%STRING%,START_POSITION,RESULT_VARIABLE,FALSE=ABSOLUTE_RESULT
position>"will be cut off",%popup%,1,cutoff,FALSE
//check for timeout and goto targeterror if it is contained
if>timeout>0,cutoff
//Returns the absolut Position of the start of a substring in a string
//position>"KEYWORD",%STRING%,START_POSITION,RESULT_VARIABLE,FALSE=ABSOLUTE_RESULT
position>"equipment identification is not",%popup%,1,ident,FALSE
//check for timeout and goto close popup if it is contained
if>ident>0,closeident
//Returns the absolut Position of the start of a substring in a string
//position>"KEYWORD",%STRING%,START_POSITION,RESULT_VARIABLE,FALSE=ABSOLUTE_RESULT
position>"communication timeout",%popup%,1,hardware,FALSE
//check for timeout and goto close popup if it is contained
if>hardware>0,harwareErr
//no detection possible
goto>otherpopup
Else
wait>1
let>popuploop=popuploop+1
//if done loop 90 times, proceed
if>popuploop=90,proceedpopup
goto>popups
Endif
goto>popups
let>popuploop=0
Label>popups
let>timeout=1
let>flash=1
let>ident=1
let>hardware=1
let>cutoff=1
setfocus>HMI600*
IfWindowOpen>Test configuration time,configtime
IfWindowOpen>HMI600
GetWindowText>HMI600,popup
Let>popup={Lower(%popup%)}
position>"nonvolantile flash memory",%popup%,1,flash,FALSE
if>flash>0,closeflash
position>"will be cut off",%popup%,1,cutoff,FALSE
if>timeout>0,cutoff
position>"equipment identification is not",%popup%,1,ident,FALSE
if>ident>0,closeident
position>"communication timeout",%popup%,1,hardware,FALSE
if>hardware>0,harwareErr
goto>otherpopup
Else
wait>1
let>popuploop=popuploop+1
if>popuploop=90,proceedpopup
goto>popups
Endif
goto>popups
Label>hardwareErr
Messagemodal>Hardware Error
goto>end
Label>cutoff
Messagemodal>link cutoff
goto>popups
Label>closeflash
let>popuploop=80
Messagemodal>closeflash
goto>popups
Label>closeident
Messagemodal>closeident
goto>popups
Label>configtime
Messagemodal>configtime
goto>popups
Label>otherpopup
Messagemodal>The failure could not be detected, pleas check HMI manually
goto>end
Label>proceedpopup
Messagemodal>finished checkin popups
Label>end
*edit* Now I found one bug, this shows me that there has to be a fundamental error in my string handling.
To show the problematic case, a little simple example-code:
setfocus>HMI600*
//Detect if another Popup is open
IfWindowOpen>HMI600
Label>popups
//if window "Test configuration time" is open, goto check off
IfWindowOpen>Test configuration time,configtime
//Gets the text of the popup (GetWindowText>WINDOWTITLE,RESULT_VARIABLE)
GetWindowText>HMI600,popup
//Lower the string to prevent failures
Let>popup={Lower(%popup%)}
//Returns the absolut Position of the start of a substring in a string
//position>"KEYWORD",%STRING%,START_POSITION,RESULT_VARIABLE,FALSE=ABSOLUTE_RESULT
position>"nonvolatile flash memory",%popup%,1,flash,FALSE
//check for timeout and goto close popup if it is contained
if>flash>0,closeflash
Else
wait>1
let>popuploop=popuploop+1
//if done loop 90 times, proceed
if>popuploop=90,proceedpopup
goto>popups
Endif
goto>popups
Label>closeflash
//set popuploop variable to 10 runs left
let>popuploop=80
let>flash=0
Messagemodal>closeflash
//proceed with popupcheck
goto>popups
Label>end