cacortes Posted October 3, 2013 Share Posted October 3, 2013 I'm trying to do something very simple: close an error message that pops up after most sleeps. Everything I try works the first time, but not after that. A reboot allows me to start over. The basic function I want to use is WinClose(), but below you can see all the stuff I've been trying after it starts failing (from looking through the forums). ;Opt("WinWaitDelay", 1000) ;250 millis default WinWait("Intelliremote","",30) Dim $r = WinActivate("Intelliremote") ;msgbox(1,"winactivate",$r) Sleep(500) ;WinKill($r) ;Send("!{F4}",0) ;Send("{ENTER}") ;if 0 = WinClose("Intelliremote") Then WinClose("Intelliremote") WinKill("Intelliremote") ;Endif ;Opt("WinWaitDelay", 250) So each function Send, WinClose, WinKill works only once. Any clues? Thanks, Carlos Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 3, 2013 Moderators Share Posted October 3, 2013 cacortes,Welcome to the AutoIt forum. As the script ends after the first pass it is hardly surprising that it only works once. Try putting it inside a loop to keep it alive. 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...
cacortes Posted October 4, 2013 Author Share Posted October 4, 2013 I failed to make myself clear. After a reboot and appearance of the unwanted "intelliremote" error window, running the script works. That's because it waits up to 30 seconds to find the window, then it activates that window, and then removes it. The second time the unwanted error window appears, I run the script but it fails to work when it should. It activates the window, but fails to get rid of it as it did the previous time. I don't put a loop in this script because it makes no sense programmatically. FYI the script is launched via the task scheduler on computer wake up when this error appears. Thanks for your help. Link to comment Share on other sites More sharing options...
kylomas Posted October 4, 2013 Share Posted October 4, 2013 cacortes, You may want to use a "WinWaitActive" (see Help file) after your "WinActivate". You are only waiting .5 secs. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
cacortes Posted October 5, 2013 Author Share Posted October 5, 2013 No dice on the WinWaitActive. Ultimately I am only activating the window as a matter of trying to fix this problem in the first place. I'd rather not flash the unwanted error window to the foreground. WinKill after WinWait should accomplish what I want perfectly, but of course it doesn't. I finally found something that works. I throw up a MsgBox with a timeout of 10 seconds after the WinActivate, then I do a bunch of closing operations. Not sure which one is actually working. But I will say this is a pretty ugly solution. 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