Jump to content

Script Not working when Windows is Locked


Recommended Posts

Hi,

I have written a small script,converted to exe. The idea of the script is to check for a window and click the button on the window. But it does NOT click the button when Windows is Locked. It works fine when Windows is NOT locked.

Thanks in advance for the help. :D

Regards,

NHKR

Link to comment
Share on other sites

Hi,

I have written a small script,converted to exe. The idea of the script is to check for a window and click the button on the window. But it does NOT click the button when Windows is Locked. It works fine when Windows is NOT locked.

Thanks in advance for the help. :P

Regards,

NHKR

Locked? What "locks" the window?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Locked? What "locks" the window?

:D

Sorry, i forgot to add the code::

While 1 = 1

WinWaitActive(" Client")

Send("{ENTER}")

WEnd

Locking happens when u lock the Windows Screen by Pressing the "Windows Key" on ur Keyboard and "L" simultaneously (without quotes)

For more information on locking please see

Locking

Regards,

NHKR

Link to comment
Share on other sites

Sorry, i forgot to add the code::

While 1 = 1

WinWaitActive(" Client")

Send("{ENTER}")

WEnd

Locking happens when u lock the Windows Screen by Pressing the "Windows Key" on ur Keyboard and "L" simultaneously (without quotes)

For more information on locking please see

Locking

Regards,

NHKR

I misread that as "a window" being locked, vice "Windows".

While the console is locked, there are no windows available to AutoIt. If your script makes no window references (like WinWaitActive) then it will continue to run, but any calls to Win* functions, or attempt to access desktop graphical interfaces (i.e. Pixel* fucntions) will hang until the console is unlocked.

:D

P.S. Correction from MHz below: The windows exist, but cannot become ACTIVE, so ControlSend() and some things that can operate on a window that is not active might work. Your WinWaitActive() however will never work while the console is locked.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I misread that as "a window" being locked, vice "Windows".

While the console is locked, there are no windows available to AutoIt. If your script makes no window references (like WinWaitActive) then it will continue to run, but any calls to Win* functions, or attempt to access desktop graphical interfaces (i.e. Pixel* fucntions) will hang until the console is unlocked.

:D

Thank you for the reply!!!

Is there any solution or workaround other than UNLOCKING Microsoft Windows

Regards,

NHKR

Link to comment
Share on other sites

...

Locking happens when u lock the Windows Screen by Pressing the "Windows Key" on ur Keyboard and "L" simultaneously (without quotes)

...

The locked screen remains the active window so you need to use Win* functions and Control* functions that do not require an active window to work with.

This example works with a locked Windows session.

Send('#l') ; Start the locked screen
Sleep(3000)
Run('notepad.exe')
WinWait('Untitled')
ControlSend('Untitled', '', 'Edit1', 'sample text sent to an inactive window{ENTER}')
MsgBox(0x40030, '', 'Script Finished') ; Unlock the screen manually now to see the result.

:D

Link to comment
Share on other sites

Test script to PROVE that MHz was right and I was wrong... (not that anybody doubted that):

HotKeySet("{ESC}", "_Quit")

$PID = Run("notepad.exe")
WinWait("Untitled - Notepad")
$hWin = WinGetHandle("Untitled - Notepad")
WinSetState($hWin, "", @SW_MINIMIZE)
SplashTextOn("AutoIt Locked Console Test", "You may lock the console to test operations...", 500, 100, @DesktopWidth - 600, 100)
While 1
    ControlSend($hWin, "", "Edit1", "Time = " & @HOUR & ":" & @MIN & ":" &  @SEC & @CRLF)
    Sleep(1000)
WEnd

Func _Quit()
    SplashOff()
    WinSetState($hWin, "", @SW_RESTORE)
    Exit
EndFunc

Live and learn... :D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...