ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

How to run a script after every win-unlock ???

(1/1)

hhbuesch:
any idea ?

Thanks and mary xmas
Peter

slowmaker:
Do you mean session unlocks, as in fast user switching (winkey+L) out, then logging back in?

If so, your script's caller needs to do some request notifications of session state changes and process them.

The only way I know to do that is win api coding:

    1) call WTSRegisterSessionNotification()
    2) catch #WM_WTSSESSION_CHANGE message and check for #WTS_SESSION_UNLOCK flag
                    * if WTS_SESSION_UNLOCK flag is detected, the script should be called
    3) call WTSUnRegisterSessionNotification() before it exits

jpprater:
You can do it in AutoHotkey.
Read this thread from the autohotkey forum.  It tells you how and provides a helpful library.
I know this works because I used it recently in a project at work.

Jon

slowmaker:
hhbuesch, this gave me an idea I started coding, not script specific, just:

run_on_unlock.exe <whatever command line you want here>

and then whenever the user comes back in from a session lock, the system will run <whatever command line you want here> verbatim, as if you'd typed it in a console session.

I don't want to step on the toes of whatever project prompted your question. Do you mind if I post a program like that elsewhere on the board?

slowmaker:
For those who are interested, I went ahead with this, over here.

The source is included in the archive.

Navigation

[0] Message Index

Go to full version