AutoITnewbee Posted October 12, 2010 Share Posted October 12, 2010 I have an AutoIt script that is displaying a msgbox too soon (before the preceeding task has completed processing). My script starts by running Adobe Framemaker and passing it a filename. Once Framemaker is launched with the desired file loaded, the script Sends() a series of keystrokes (simulating the various steps a person would manually perform when processing the file inside of Framemaker). At the very end of the script I need to display a msgbox that notifies the operator that the Framemaker file is done processing. Unfortunately, the msgbox at the very end of my script is displaying prematurely (it's not waiting for Framemaker to finish processing). FYI: I've read posts about using RunWait(). But it seems like RunWait() is geered more for controlling the run order between apps (i.e. run Notepad.exe first, then when that's done, run calculator.exe). In my case, I only have one app (Framemaker.exe). But within that one app, I am performing a series of sequential steps (some of which take 20 minutes to finish processing before going onto the next step). How do I force AutoIt to wait for a step to complete before going onto the next step (all within the same app)? FYI: I tried using the Sleep() command in between the last processing step and my "Process Complete" msgbox. Although it worked when processing my small Framemaker test file (the Sleep delay was for 2 minutes), it failed when processing a much larger Framemaker test file (it displayed the "Process Complete" msgbox while Framemaker was still processing the file). After I pressed OK to the "Process Complete" msgbox, Framemaker then continued processing the file. How do I tell AutoIt to wait for Framemaker to finish processing the file, THEN display the "Process Complete" msgbox? Please help... because without a solution to this timing issue, I won't be able to use this awesome script in Production! :-( Thank you. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 12, 2010 Moderators Share Posted October 12, 2010 AutoITnewbee,Welcome to the AutoIt forum. You need to find something in the Framemaker GUI which changes when the processing is finished and then use that as the trigger for your MsgBox. Is there a button which changes colour or text? Does the status bar alter? Is the window title changed? You get the idea. 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...
Chimaera Posted October 12, 2010 Share Posted October 12, 2010 (edited) Or can you make a check for eg If FileExists("well known windows file in system32 folder") Then MsgBox (0, "Etc", "Etc") It dosent have to be relevant to your script just something to tie the msgbox at the end right at the last thing? Chimaera Edited October 12, 2010 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
iamtheky Posted October 12, 2010 Share Posted October 12, 2010 (edited) you could wait for the process usage to drop below a threshold, then have that kick off the messagebox. My example is for firefox, open up a bunch of tabs (such that you are over 170,000k on Mem Usage) start closing them and when it drops under the threshold it should pop a message box displaying usage. expandcollapse popupGlobal $MemUsage , $x _RUN() Func _Check() If $x = 1 Then _RUN () EndIF EndFunc FUNC _Run() _checkproc() If $Memusage < 170000000 Then msgbox (0, '' , "Memory Usage " & $Memusage) $x = 0 else sleep (500) $x = 1 _Check() Endif EndFunc Func _Checkproc() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output &= "Computer: " & $strComputer & @CRLF $Output &= "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfProc_Process Where Name='firefox'", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $objItem In $colItems Global $MemUsage = $objItem.WorkingSet Next EndFunc Edited October 12, 2010 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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