Sign in to follow this  
Followers 0
AMSMA

script not working when system locked

8 posts in this topic

#1 ·  Posted

creates below script with the help of autoit recorder.

script is not working when system locked.

requesting you to convert the script, so that it can work when system is locked.

Regards/AMSMA

 

#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000409)  ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
If $aResult[1] <> '00000409' Then
  MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')')
EndIf

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()
#endregion --- Internal functions Au3Recorder End ---

_WinWaitActivate("Program Manager","")
MouseClick("left",274,446,2)
_WinWaitActivate("C:\Windows\system32\cmd.exe","")
Send("director{SHIFTDOWN}2{SHIFTUP}del2{SHIFTDOWN}8{SHIFTUP}{ENTER}")
#endregion --- Au3Recorder generated code End ---

Share this post


Link to post
Share on other sites



#2 ·  Posted

It run when system is locked but is waiting for Program Manager get active.

Share this post


Link to post
Share on other sites

Dear AutoBert,

thanks for replying

but how to resolve this problem "waiting for Program Manager get active"

what to do for program manager to get active ??

how the program manager will get active automatically to execute the script ??

Regards / AMSMA

Share this post


Link to post
Share on other sites

I know no method to activate program manager window with enabled lock screen. There are security reasons MS not allowing it.

Share this post


Link to post
Share on other sites

Several reasons why this script will not work:

  1. If the screen is locked, "Send" will NOT work. 
  2. Waiting for any screen will not work for the system is locked. 
  3. mouseclick - you guessed it - the machine HAS to be unlocked for that to work. 

What "may" work is using command line to interact with the process you are trying to interact with in the program manager. What would be helpful in trying to solve your problem is - What are you trying to do here?

In other words - don't tell me what you are doing with the program manager. Tell me something like - "I need to stop a process from running" or "A process needs to have its priority to real time"

Once we know WHAT you want to do - we may be able to give you a much better solution on how to do it and have it run while the screen is locked. 

Share this post


Link to post
Share on other sites

Dear Bert,

thanks for replying

i am running a cwrsync batch file.

to perform rsync backup from linux to windows.

using auth keys.

but when i run the batch file a console opens where linux server asks for password.

so i have used au3record to automatically insert password in that console

now script created with au3record is not working when system locked.

Regards /AMSMA

Share this post


Link to post
Share on other sites

As I said above - if the screen is locked - anything that interacts with a window such as "send" or "mouseclick" in your script will not work. You have to use command line to do what you need.

Question - is there an application you can put on the Linux box so you can schedule the backup automatically? That way you don't have to interact with it at all.

Note: I've read where one can use WINE to run AutoIt on a Linux box. I have no experience with it however.

Share this post


Link to post
Share on other sites

Dear Bert,

Thanks for replying.

requesting you to replace "send" & "mouse click" with commands in below script

i don't know how to script with autoit.

that's why i used autoit recorder to automatically create autoit script.

i don't have rights to install any new package or software on linux server.

Regards / AMSMA

 

#region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000409)  ---

#region --- Internal functions Au3Recorder Start ---
Func _Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '')
If $aResult[1] <> '00000409' Then
  MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')')
EndIf

EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc

_AU3RecordSetup()
#endregion --- Internal functions Au3Recorder End ---

_WinWaitActivate("Program Manager","")
MouseClick("left",274,446,2)
_WinWaitActivate("C:\Windows\system32\cmd.exe","")
Send("director{SHIFTDOWN}2{SHIFTUP}del2{SHIFTDOWN}8{SHIFTUP}{ENTER}")
#endregion --- Au3Recorder generated code End ---

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