Jump to content

[Help] How to proceed to next step after a text disappear?


Recommended Posts

Hi guys.

My name is Fernando [from Brazil] and this is my first post.

-

I searched for a solution but with no success, on how to procceed to next step in my script after a text dissappear from a window.

Example: I have a window that show in statusbar the message "Counting", and the message disappear when the task (counting) ends.At this point, I need to procceed to next step in the script.

This may be a silly question, but I really cant find the answer.

Thanks

Link to comment
Share on other sites

  • Moderators

Hi, ssnake, welcome to the forum. Can you please post your script, so we can see what you're attempting to do? Otherwise we're just guessing :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi, ssnake, welcome to the forum. Can you please post your script, so we can see what you're attempting to do? Otherwise we're just guessing :)

Oh, sorry.

Please note that's just a test script that I'm using with SAP frontend

#include <Excel.au3>
#include <Array.au3>
dim $Linha = 1
$oExcel = _ExcelBookOpen("O:\080-CONSTRUCAO E MONTAGEM\080-100-EQUIPAMENTOS\Planilha Pulo do Gato.xlsx")
_ExcelSheetActivate($oExcel, "Plan1")
$Matriz = _ExcelReadSheetToArray($oExcel)
_ExcelBookClose($oExcel)
while $Linha <> (UBound($Matriz,1)-1)
WinActivate("Relatório do operador")
WinWaitActive("Relatório do operador")
send("^a")
send($Matriz[$Linha][1])
send("{DOWN}")
send("^a")
send("C279")
send("{DOWN}{ENTER}{DOWN}")
send("^a")
send($Matriz[$Linha][2])
send("{ENTER}")
WinWaitActive("Selec.elemento PEP")
sleep(2000)
;Here I need to test if the "Counting" message disappeared. For now, the sleep helped a little
send("{ENTER}")
WinWaitActive("Relatório do operador")
send($Matriz[$Linha][3])
send("{ENTER}")
sleep(1000)
send($Matriz[$Linha][4])
send("{TAB}")
send($Matriz[$Linha][5])
send("{ENTER}")
sleep(1000)
send("^s")
sleep(1000)
$Linha = $Linha+1
wend

Check the help file for StatusbarGetText.

I'll check it. Thanks
Link to comment
Share on other sites

I'm not absolutely certain exactly what you mean by statusbar, but could you not use WinExits(), with visible text, in a loop to identify whether the process has completed (or am I completely missing the point)

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Link to comment
Share on other sites

I'm not absolutely certain exactly what you mean by statusbar, but could you not use WinExits(), with visible text, in a loop to identify whether the process has completed (or am I completely missing the point)

Yup, a loop can help, but I was just wondering if theres no way to do this more effectively.

But thanks guys

Link to comment
Share on other sites

  • Moderators

Have you used the AutoIt Window Info Tool on the window you're trying to wait on? If you can capture both the title and the text you could do something like this:

While WinExists("title of window", "Counting")
   Sleep(500)
WEnd

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yup, a loop can help, but I was just wondering if theres no way to do this more effectively.

If you just want your script to wait until an event, then using a loop with a small sleep interval to reduce memory usage is best (JLogan3o13 just posted an example). If you want your script to remain active while waiting for an event then using something like AdlibRegister is a possibility. I don't think it applies here though.

Edited by czardas
Link to comment
Share on other sites

Have you used the AutoIt Window Info Tool on the window you're trying to wait on? If you can capture both the title and the text you could do something like this:

While WinExists("title of window", "Counting")
Sleep(500)
WEnd

If you just want your script to wait until an event, then using a loop with a small sleep interval to reduce memory usage is best (JLogan3o13 just posted an example). If you want your script to remain active while waiting for an event then using something like AdlibRegister is a possibility. I don't think it applies here though.

You guys are awesome. Thanks!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...