naul Posted January 9, 2014 Share Posted January 9, 2014 (edited) 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 January 9, 2014 by naul Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 9, 2014 Moderators Share Posted January 9, 2014 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 More sharing options...
naul Posted January 9, 2014 Author Share Posted January 9, 2014 (edited) Thank you for your quick response - Im starting to really love autoit! >>>> Visible Text <<<< To interrupt the search operation, press Break. BreakSearch in progress... Objects found: 0 >>>> Visible Text <<<< Would you like to browse results or modify your search? Browse Modify BreakSearch 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 January 9, 2014 by naul Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 9, 2014 Moderators Share Posted January 9, 2014 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 More sharing options...
mikell Posted January 9, 2014 Share Posted January 9, 2014 (edited) Or like this, should work even without the title $hWnd = WinWait("", "Search in progress") ; popup window $hTimer = TimerInit() While 1 If StringInStr(WinGetText($hWnd), "Search ended") Then Exitloop ; check "Search ended" Wend $iDiff = Round(TimerDiff($hTimer)*1000) ; time in sec Edited January 9, 2014 by mikell Link to comment Share on other sites More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 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 More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 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 More sharing options...
ajag Posted January 10, 2014 Share Posted January 10, 2014 (edited) If you want to see a message box then you have to programm it ;-) MsgBox(4096, "Time", $iDiff) A-Jay Edited January 10, 2014 by ajag Rule #1: Always do a backup Rule #2: Always do a backup (backup of rule #1) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 10, 2014 Moderators Share Posted January 10, 2014 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 More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 thanks! ideally I would want the results sent to a text file... but thats the next step... Also the number which it returns i.e. 10799574, how can I transloate to seonds? Thanks!!! Link to comment Share on other sites More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 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 More sharing options...
Moderators JLogan3o13 Posted January 10, 2014 Moderators Share Posted January 10, 2014 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 More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 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 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 10, 2014 Moderators Share Posted January 10, 2014 You've lost the decimals because you're using Round. "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 More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 Found this and did this: $iDiff = Round(TimerDiff($hTimer)/1000,2) '?do=embed' frameborder='0' data-embedContent>> I'm loving it! now need output to text!!! tytytyty Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 10, 2014 Moderators Share Posted January 10, 2014 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 More sharing options...
Solution naul Posted January 10, 2014 Author Solution Share Posted January 10, 2014 omg I'm sooooo happy - thank you sooo very much its works beautifully!!!! think I'll get some cake to celebrate! Link to comment Share on other sites More sharing options...
naul Posted January 10, 2014 Author Share Posted January 10, 2014 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 More sharing options...
Moderators JLogan3o13 Posted January 10, 2014 Moderators Share Posted January 10, 2014 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 More sharing options...
Moderators Melba23 Posted January 10, 2014 Moderators Share Posted January 10, 2014 naul,I have lifted your "New Member" posting restriction. A good time to remind people of this announcement. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now