Jump to content

Screensaver, Sleep, Workstation Lock, and Power-Save Disabling


twp
 Share

Recommended Posts

  • Moderators

   As someone who has worked in a medical IT environment, I know the issues with legacy applications. It really sounds like you are doing 10 times the work for not wanting to investigate the proper approach to installing this application. If this installation is that difficult to manage, rather than some seat-of-the-pants disabling of standby you should be looking into investing the time and energy into properly repackaging the application into an MSI that then could be run silently.

   Even the most difficult application probably could have been finished, just in the time you've spent seeking this answer over the past couple of days.

"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

   As someone who has worked in a medical IT environment, I know the issues with legacy applications. It really sounds like you are doing 10 times the work for not wanting to investigate the proper approach to installing this application. If this installation is that difficult to manage, rather than some seat-of-the-pants disabling of standby you should be looking into investing the time and energy into properly repackaging the application into an MSI that then could be run silently.

   Even the most difficult application probably could have been finished, just in the time you've spent seeking this answer over the past couple of days.

There is now way to make this one silent!

Link to comment
Share on other sites

I have worked in the Systems Management field of IT (deploying customized software packages to many PCs) for several years and while I prescribe to the idea that repackaging is a last resort, it will - indeed - allow you to deploy this (or any software installation) silently.

Repackaging is an attempt to capture the changes made by a legacy installation and then "repackage" it into a standard Windows Installer (MSI) based installation that provides all of the features of a standard Windows Installer based installation (including all of the command-line switches for installing it quietly or silently).

To get an idea of what repackaging can do for you (and it may even provide all you need for this particular job), check out the free AppDeploy Repackager.

Link to comment
Share on other sites

  • Moderators

I think we have debated our opposing views before, TXTechie. I personally look at repackaging as the first resort, rather than the last.  :)

"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 don't think we debated, just stated our views/perspectives. Also, you are obviously not alone in your particular perspective. I used to do repackaging (for all deployed software), but it does have its drawbacks and disadvantages. Even Microsoft doesn't use it for all of their software installations.

I highly respect your advice/input/feedback and I'm glad you are an MVP on the AutoIt Forums! I have learned (and I'm sure I'll continue to learn) from you here.

Link to comment
Share on other sites

I have tested the following Functions and it seems to work. The desktop does not freeze during installation. However, I have another smal problem. The user can still lock the computer manually. How do I prevent it while the script is running?
Func _PowerKeepAlive()
#cs
    ; Flags:
    ;    ES_SYSTEM_REQUIRED  (0x01) -> Resets system Idle timer
    ;    ES_DISPLAY_REQUIRED (0x02) -> Resets display Idle timer
    ;    ES_CONTINUOUS (0x80000000) -> Forces 'continuous mode' -> the above 2 will not need to continuously be reset
#ce
    Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000003)
    If @error Then Return SetError(2,@error,0x80000000)
    Return $aRet[0]    ; Previous state (typically 0x80000000 [-2147483648])
EndFunc

Func _PowerResetState()
    ; Flag:    ES_CONTINUOUS (0x80000000) -> (default) -> used alone, it resets timers & allows regular sleep/power-savings mode
    Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000000)
    If @error Then Return SetError(2,@error,0x80000000)
    Return $aRet[0]    ; Previous state
EndFunc
Link to comment
Share on other sites

BlockInput

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

A simple way to deal with the problem is start two processes. The first process (exe) only has the code to move the mouse every 60 seconds. The second process performs the install. Once the install is complete the mouse process closes. That way the OP does not need to modify his original script that does the install. It is a simple matter for the mouse script to look for the install script exe and if it is running or not. If it has closed the the mouse script would exit.

To keep the users from locking the PC manually, that is a different problem. My best suggestion is to use a splash screen with a message for the user to not touch the keyboard or mouse while the install runs.

I looked at your example. Are you using controlsend in your script or send? Using send is never a good idea during installs for if the window loses focus then the script fails.

Edited by MBALZESHARI
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...