Close pop up windows that rises during powershell script execution - powershell

I'm new with powershell and I'm trying to execute a third party program from command line. In one of the executions path, suddenly a pop up window emerges and the script is paused until I click on the accept button or close that window.
What I need is to avoid that click.
Is it possible to tell the script to close any emerging window or to send an event to close it?
Those windows that suddenly pop up make it impossible for me to achieve my task... Is there any other way to handle this?

Related

Exiting out of a running Python script when script window is hidden

I have a Python script written using Visual Studio Code that periodically moves the mouse icon to keep the computer active and stop it from falling asleep. This computer is used for displaying other info, so when the program is running the script window is minimized and another window is selected and opened and then the computer is left alone. When I want to use the computer again the Ctrl+C keyboard interrupt to terminate the script does not work unless the script window is reopened. This proved to be annoying as the script takes control of the mouse away from the user. I have a 'time.sleep' command that pauses the mouse movement to allow for user control again for a bit, but I would like to be ab le to just exit the script without having to wait for this pause to be able to open up the script window.
I am fairly new to Python, so I am unsure of other commands or keyboard inputs that might allow this to be possible.
The code I have does utilize the pyautogui module and has the default failsafe of moving the mouse icon to the corner of the screen enabled. However, this still requires me to wait for the pause in the script when I have control of the mouse again.
This is for a Windows environment.
If you are using pyautogui, just quickly move your mouse to the top left corner of the screen and your program will stop

Closing a window whenever it pops up inside other AHK script?

I have made an AHK script that will take file names from an Excel spreadsheet, open the file in a different program, then export that file to two different formats.
It's working pretty well, except sometimes, the file has some little tweak that needs to be done with it (wrong orientation, hidden layers, etc) that create a popup.
I've tried to program around that by using ifwinexist conditions, so that if I know when a window is SUPPOSED to pop up, the script can deal with it.
The problem I have is that the popup windows can happen at times that I do NOT expect.
So, is there a way to run a thread until the window pops up, closes the window, but then will continue to look for the window?
Thank you
You are looking for SetTimer, which spawns another thread. The following code checks for the window with partial name Notepad every second (1000ms), and closes it if found.
SetTitleMatchMode, 2
SetTimer, CheckWin, 1000
CheckWin:
IfWinExist, Notepad
WinClose, Notepad
Return

Matlab command window unresponsive after losing focus

I am using matlab on linux with gnome and I have a problem with the command window. Note that this problem goes away when I switch to twm, but I don't want to do that (for obvious reasons).
When the command window loses focus and then regains focus, it freezes, i.e., it ignores anything I type. The only consistent way I've found to unfreeze it is to click somewhere within the matlab window, but outside the command window (for example, the workspace or command history windows), and then click back in the command window.
This is very annoying and it happens all the time. Any help would be appreciated!
Thanks

Is there a way to handle popups during playback using Sahi Pro without each popup opening its own controller window?

I'm testing a list of links using Sahi Pro, and each link opens a popup window in which I have to assert that a few elements are available. I'm able to use _closeWindow to get rid of each popup, but I've noticed that every time a new popup loads, it opens a new Sahi controller window to execute the script within that popup. These controller windows do not close when the popups close. Before long there are so many open controller windows that test execution freezes.
Is there a way to close these controller windows programatically? Or to prevent a new one from accompanying each popup in the first place?
This can be avoided by running scripts as test suites from the command line.

Command Line Windows Hanging in RDP Windows

We regularly access the build machine through RDP and it there are lots of command line windows that open. Sometimes these windows hang like someone switched focus to them and press the Pause key. Tapping the keyboard moves the process along, but every once in a while this is missed and everyone waits on the process to finish while it is waiting for someone to press a key. Why does this happen? Is there a setting or version up/down-grade that can keep it from happening?
When this happens, does the window title say "Select Command Prompt"? If so, hitting a key will unpause it, but the keystroke will also be sent to the paused program unless it's ESC or enter (or possibly others). You can turn this feature off by going into the Command Prompt properties/defaults and unchecking "QuickEdit Mode".
If that's not it, you'll have to post more information about your build process. What is your build system written in (make, scons, jam, msbuild, etc.)?
One thing to watch out for in command line Windows; if you have QuickEdit Mode enabled (click on icon in title bar, Properties..., Options tab) you can highlight and copy with the mouse, bypassing the Edit menu. Stray mouse clicks in the window highlight the character underneath and the console will appear to "hang" until a key is pressed.