Jump to content

Popup Box


naul
 Share

Go to solution Solved by naul,

Recommended Posts

Hi Guys,

Two Part Question but both related to Pop UP Boxes:  I wanted to know if/how I would be able to do the following;

Q1:

Once the application has started:

A popup box is Displayed Showing "In Progress"

I would like to time the duration taken from the start of the popup box until the words "Ended" are displayed, and the output sent to an external file.

 

Q2:

Also, I would like to read the numerical results displayed within the popup box and store these values within the same external file.

Any help, guidanance, direction would be very much appreciated.

Thanks for looking!

naul

Edited by naul
Link to comment
Share on other sites

  • Moderators

Hi, naul, welcome to the form.

In short, the answer to your question depends on the application generating the pop up box. I would suggest you use the AutoIt Window Info tool (AU3Info or Au3Info_x64, found in the same directory where AutoIt is installed) on the pop up box, to see what information you can retrieve. If you are able to see "In Progress" or "Ended" under the Visible Text tab, then Q1 should be pretty simple. The same goes for Q2, if you can capture the text you can then look in the help file for methods to write it out to the filetype of your choice (see FileWrite, IniWrite). Give it a go, and feel free to post your code if you get stuck.

"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

Thank you for your quick response - Im starting to really love autoit!

 

>>>> Visible Text <<<<
To interrupt the search operation, press Break.
Break
Search in progress...
Objects found: 0
 

>>>> Visible Text <<<<
Would you like to browse results or modify your search?
Browse
Modify
Break
Search ended
Objects found: 50000

Is there a function/method I can use to time the difference in speed between in progerss to ended?  that would be awesome and I will have to make a donation!!!!

Edited by naul
Link to comment
Share on other sites

  • Moderators

Without knowing more about the app, you could try something like this. You may have to play around with it a bit:

#include <MsgBoxConstants.au3>

WinWait("<Title>", "Search in progress...")
    $timer = TimerInit()
WinWait("<Title>", "Search ended")
    MsgBox($MB_SYSTEMMODAL, "", TimerDiff($timer))

"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

You guys are awesome!!!  really good - going to play and will update you later in the day...

 

NB:  I'm trying to click Like this on the messages but it says daily quota reached but anywho I liked/loved your replies!!

POETs Day! ;)

Link to comment
Share on other sites

Agh - I'm missing something,  please could you help!! Sorry the message box doesnt display :(

#include <MsgBoxConstants.au3>

Run("C:Program FilesWinBatchScriptsTestTeststartPROD.exe")
WinWaitActive("Test - User Identification")
Send("john{TAB}")
Send("password{ENTER}")
WinWaitActive("Main Menu")
ControlSetText("Main Menu", "", "[CLASS:Edit; INSTANCE:1]", "football")
ControlCommand("Main Menu", "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", 'Photo')
ControlClick("Main Menu", "", "[CLASS:Button; INSTANCE:1]")

$hWnd = WinWait("", "Search in progress")
$hTimer = TimerInit()
While 1
  If StringInStr(WinGetText($hWnd), "Search ended") Then Exitloop
Wend
$iDiff = Round(TimerDiff($hTimer)*1000)

;Sleep(10000)
;WinWaitActive("Query result")
;Send ("!{F4}")
;Send ("!{F4}")
;WinWaitActive("Query")
;Send ("{ENTER}")

Link to comment
Share on other sites

  • Moderators

naul, what is the application you're automating? Looking at what you have posted, there may be an easier way to do what you're trying to accomplish.

"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

Hey!

The application is like a web search engine, but windows desktop application used to extract images.  I dont have backend access to the database to execute queries directly and the db is customised apache lucene.

Basically AutoIt is almost there!!  woot!  it launches, authenticates, enters the search term selects type of search (picture) and executes the search.  I'm trying to gather performace metrics for whereby I will add this as a hourly scheduled job and for the results to be output to a file which I can feed into nagios/zabbix:

Thanks for your help!

n.

Link to comment
Share on other sites

  • Moderators

To answer your previous question, time returned is in milliseconds. It looks like you're doing $iDiff * 1000 instead of $iDiff / 1000.

"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

kay - I modfied

;$iDiff = Round(TimerDiff($hTimer)*1000)
$iDiff = Round(TimerDiff($hTimer)/1000)

To get seconds but I've lost the decimals - but for now its cool!  next step to get this interger into a text file back to the second post and FileWrite, IniWrite!

your guys' help is always welcomed :D

Link to comment
Share on other sites

  • Moderators

Simply a FileWriteLine(<name of text file>, $iDiff & " seconds.") should do what you want.

"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

lol one more thing - how can I overwrite the content of the text file each time the script is executed - this would be perfect for porting into monitoring and start trending!!! 

 

I have a message on the forum saying only 1 more post allowed today :(

if I can post then just wanted to say I hope you have a very nice weekend indeed!

Link to comment
Share on other sites

  • Moderators

FileWriteLine appends to the end of a file. If you want to overwrite, look at _FileWriteToLine in the help file.

"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

  • Moderators

naul,

I have lifted your "New Member" posting restriction. :)

A good time to remind people of this announcement. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...