Jump to content

Help to resolve the problem of scripts execution while windows screen is locked


JackLiu
 Share

Recommended Posts

Hi guys ,

I found Autoit scripts can’t be executed normally after the screen was locked in Windows2003. The keyboard operation , for example “Alt + F” have no response in the condition of locked screen. The left click operation which mimic mouse wasn’t also correctly executed in window, as if the script automatically is stopped when executing the mouse operation by Autoit .

Is it a bug that AutoIt will exceptionally be executed in the situation of locked screen ? If not , please teach me how to write the script , thanks very !

Here referred to my scripts below :

//begin

$kcxpPath = IniRead(GetConfigFile(),"KCXP","kcxpPath","")

$kcxpProgram = IniRead(GetConfigFile(),"KCXP","kcxpProgram","")

$kcxpWinTitle = IniRead(GetConfigFile(),"KCXP","kcxpWinTitle","")

$flag = -1

If ChkService($kcxpProcess) = 0 Then

Run($kcxpProgram,$kcxpPath)

$flag =1

Else

If ChkProgram($kcxpWinTitle)=0 Then

Run($kcxpProgram,$kcxpPath)

$flag =0

EndIf

EndIf

WinWait($kcxpWinTitle,"",$WaitWinTime)

WinActivate($kcxpWinTitle,"")

$kcxpWinTitle = WinGetTitle("[active]")

If $flag = 1 Then

Sleep(1000)

ControlCommand($kcxpWinTitle,"",$kcxpWinToolbar, "SendCommandID" , $kcxpStartBtnId)

Sleep(6000)

$tmpWin = WinGetTitle("[active]")

EndIf

//end

Link to comment
Share on other sites

Hi ,

I am not sure exactly how the issue was... but if i am not wrong, in particular case your machine got locked due to your script. so you want it to resume back.. correct... i had thi kind of situation where my machine will get locked an i can not be used mouse or keyboar.. to fix this i used below function

WinActivate("","")

All we should do is we should call this function in a correct line where it getting locked... for example... if your machine is getting locked on the below line

"ControlCommand($kcxpWinTitle,"",$kcxpWinToolbar, "SendCommandID" , $kcxpStartBtnId)"

Then you have to add the function WinActivate("","") next to the above line... please correct me if i am wrong!!!

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

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...