Sign in to follow this  
Followers 0
LT2000

Can you Pause Screen Refresh While Script Executes?

18 posts in this topic

I wrote a few simple scripts that perform actions. But I don't want to see windows flashing or the mouse pointer move while it is being executed. I was wondering if there was a way to first turn off display refresh and then turn display refresh back on after the script executes? Of course, even if that is possible, then there is a concern about something going wrong and the screen refresh being turned back on in the event of a crash/other.

Share this post


Link to post
Share on other sites



Are you manually causing a screen refresh, or is it just something you're experiencing during the course of your script running. As is almost always the case, it is a little difficult to provide advice when you don't provide any code to show us what you're doing.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Here is a simple example. This just restores a few windows that may be minimized, but the screen flashes while doing it.

Send("{ALTDOWN}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{ALTUP}")

The goal is to not experience that flashing effect by somehow pausing the screen refresh

Edited by LT2000

Share this post


Link to post
Share on other sites

What is the name of the window? You should be able to use WinActivate instead of Send commands, with no flashing.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

A couple issues:

- The window name is unknown. This just restores all existing windows, regardless of the name. There may be multiple instances of a program as well. It actually looks like this in reality. Pretty crude, but gets the job done.

Send("{ALTDOWN}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")
Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")

- I have another script that would benefit from a non-refresh, which I am nearly certain there is no other way to perform other than Send key commands.

Edited by LT2000

Share this post


Link to post
Share on other sites

WinList and WinActivate in a loop would be a lot more efficient.


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

Share this post


Link to post
Share on other sites

I agree with KingBob, WinList if you have a bunch of windows. And if the window title is unknown, what criteria are you using to identify it, so you're restoring the correct window - text? position? etc? There are very few cases when Send is your only answer.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

WinList and WinActivate in a loop would be a lot more efficient.

I don't disagree, but like I mentioned, that was just an example. There is another script which must use Send key commands that has the same issue. I am actually more interested in the other one, but this one is easier to demonstrate as an example.

Edited by LT2000

Share this post


Link to post
Share on other sites

Too much evasion for my liking, I'm out. Good luck with your project.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

- Its not evasion. I was trying to make it simple and was using that as an example, as requested. As I feared, things then got specific and transitioned into how to solve a problem that didn't need solving. Hence, the reason why I did not post a specific example initially.

- Here is the real problem: In Win10 (which many people don't have yet and why I didn't post an example for), I am trying to access various virtual desktops. The only way to do that is to use WIN+CTRL+arrow. If there is another way to access these virtual desktops, I am all ears. But I can't find anything in AutoIT. Perhaps in a later build though.

- And if there is no way to pause the screen refresh, the can't that just be said since that was the original question? I simply don't know if this is even possible.

Edited by LT2000

Share this post


Link to post
Share on other sites

So, basically this thread is a duplicate of your other thread on this topic? If you didn't get any replies on that first one, why not bump it rather than start a second (much more confusing) topic?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Oops, yes you are right. I thought I had phrased that differently, but it is basically the same. I should have bumped it. In this thread, I was trying to be more specific with the title since I had given up on doing something more "native" to address it. Pausing the screen refresh is a last resort option, not a primary option. In the other thread, I was still looking for a native option really.

Edited by LT2000

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

This is my best idea but it wont help with any kind of virtual desktop setup as anything you display on screen is bound to change with the desktop (I would assume)

 

Of course if this actually does what you want, save to @TempDir and change as needed.

#Include <ScreenCapture.au3>

;Current Desktop Image
_ScreenCapture_Capture(@DesktopDir & "\bg.bmp")
;Display Image
SplashImageOn("", "bg.bmp", @DesktopWidth, @DesktopHeight, -1, -1, 1)
;Do your "stuff"
ShellExecute("Notepad.exe")
Sleep(5000)
;Desktop Reappears After "stuff"

 

Edited by ViciousXUSMC

Share this post


Link to post
Share on other sites

You took this thread in a totally different direction, and until you told us what you're really attempting it made more sense. If you had started with the actual issue you were facing rather than trying to tell us it was related to activating windows in a sequence, we could have gotten here sooner.

There is no key sequence or API currently that allows you to choose a specific virtual desktop in Windows 10, you have to cycle through them.


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

Share this post


Link to post
Share on other sites

Thanks guys, sorry about being a hassle about it. I was trying to "fine tune" the request, but it did not work out as well as I hoped.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

ViciousXUSMC: Thanks, I gave it a shot and got it to run, but it doesn't seem to serve the intended purpose.

Edited by LT2000

Share this post


Link to post
Share on other sites

Just curious...is it possible to minimize all windows (on all virtual desktops in Win10) and then restore just the windows that were not originally minimized?

The thought here is that you would (1) minimize all windows (2) use keyboard shortcuts to navigate to desktop (3) restore the window "state" as is was before script was run.

I suspect this would minimize the apparent "flashing" since the flashing is really just the fact that you are viewing all the open windows on the virtual desktops. If you are just seeing the background, it might look OK.

Share this post


Link to post
Share on other sites

You would follow the same general course, get a list of windows and then cycle through them with WinGetState to find out which are Minimized and which are not.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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
Sign in to follow this  
Followers 0