Jump to content

Account for system interruption?


Go to solution Solved by kaotkbliss,

Recommended Posts

Im a bit lost say if my script is running and windows being the way it is produces a pop up window that will obviously interrupt my script.

What would be the best way to account for these in a script?

Link to comment
Share on other sites

Hi,

What kind of popup are you talking about? A MsgBox/InputBox?

Br, FireFox.

 

Hey Firefox,

The usual kinds of system interruptions associated with windows.

As you said msgbox & input box, or say if I was running a script and I get the windows auto-update pop up window, or some other window like an installation window or stuff along those lines.

 

Regards,

Olo

Link to comment
Share on other sites

Okay so external popups.

Why would it interrupt your script? What kind of script do you have?

Br, FireFox.

Well to describe it as best as I could my script is interactive.

As in it opens a program runs through a set of tasks etc does that for multiple files then exits.

So if I got an external popup it would surely halt or cause the script to run into error.

Link to comment
Share on other sites

You need to check the active window before making any action and if another one is active then reactivate the window.

If you are using the Send function, check the SendKeepActive one.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

You need to check the active window before making any action and if another one is active then reactivate the window.

If you are using the Send function, check the SendKeepActive one.

Br, FireFox.

Thanks Ill give that a go.

Could I ask though, is there any function that blocks all exterior access until the script has finished execution?

Link to comment
Share on other sites

Use BlockInput, you can unlock it with the Ctrl+Alt+Del hotkey. Take a look at the help file for more infos.

Br, FireFox.

Yea I had a look at that but does that not just block the mouse/keyboard?

Im not actually worried about someone interrupting the script, more so windows itself doing that.

Link to comment
Share on other sites

haha yes my bad. No it's not possible to block external program access, you will have to kill the processes or e.g for windows update disable the automatic updates.

Br, FireFox.

Link to comment
Share on other sites

haha yes my bad. No it's not possible to block external program access, you will have to kill the processes or e.g for windows update disable the automatic updates.

Br, FireFox.

haha thanks. It is interesting.

I wonder if I could even anticipate them popping up? Then kill them and record them to my log.

Link to comment
Share on other sites

If you're "sending" a series of keystrokes or strings to windows, the best advice is use ControlSend instead of Send, this way it will only send the information to the correct windows and the popups shouldn't affect it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

If you're "sending" a series of keystrokes or strings to windows, the best advice is use ControlSend instead of Send, this way it will only send the information to the correct windows and the popups shouldn't affect it.

see I do use controlsend but I also have a few Send commands. 

Like I suppose say if i got an access violation window pop up. Id like to identify and then close it and resume my script.

Link to comment
Share on other sites

  • Moderators

Olo, I see a lot of suggestions, all of which you are shooting down - how about producing some actual code so we can see what you're doing? And perhaps a screenshot of these "pop-ups"? Otherwise, you're asking us to first guess at what you're doing, and then try to resolve why it is not working for you. Help us help you ;)

"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

I agree with JLogan3o13, you say you're using this and that but how are we suppose to know? Perhaps helping out around here once in a while will really give you perspective of how important it is to provide as much detail as you can.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I have a script here at work that runs 24/7 and turning off the automatic updates has been dissabled so I would usually get those popups telling me new updates have been installed and the pc needs to reboot. I also get popups from outlook telling me the IMAP server has closed.

Since I know what windows are going to popup just not when, I added a check for these windows in a second script that runs constantly and if they exist, then either close them or minimize them. This has worked for me for a long time now.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I have a script here at work that runs 24/7 and turning off the automatic updates has been dissabled so I would usually get those popups telling me new updates have been installed and the pc needs to reboot. I also get popups from outlook telling me the IMAP server has closed.

Since I know what windows are going to popup just not when, I added a check for these windows in a second script that runs constantly and if they exist, then either close them or minimize them. This has worked for me for a long time now.

What your saying is exactly what Im trying to do. :)

Link to comment
Share on other sites

  • Solution

Here's the ver simple script I have running along side my main for automatic updates

While 1
If WinExists("Automatic Updates") Then
ControlClick("Automatic Updates","","[CLASS:Button;INSTANCE:2]")
EndIf
Sleep(10)
Wend

and the one for Outlook

AutoItSetOption("WinTitleMatchMode",2)
While 1
If WinExists("Office") Then
            $text = WinGetText("Office")
            $str = StringInStr($text,"Your IMAP server has closed the connection.")
            If $str <> 0 Then
                WinActivate("Office")
                ControlClick("Outlook","","[CLASS:Button;INSTANCE:1]")
                ControlSend("Inbox - Microsoft Outlook","","[CLASS:MsoCommandBar; INSTANCE:1]","{F9}")
            Else
                ;
            EndIf
        EndIf
Wend



Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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