Sign in to follow this  
Followers 0
Nova

Admin quick lock and log

16 posts in this topic

Hi i cant seem to send the keys

Windows key down and L which is the command for and administrator to lock a computer down and exit to the logon screen.

Can anyone help me wiht this ?

If the windows key isnt allowed to be sent ! Dose anyone know of a way I can achieve this with out using the hotkey Win L ?

:ph34r:

Share this post


Link to post
Share on other sites



@nova

According to the online documentation:

{LWIN}          Left Windows key

{RWIN}          Right Windows key

{LWINDOWN}  Holds the left Windows key down until {LWINUP} is sent

{RWINDOWN}  Holds the right Windows key down until {RWINUP} is sent

But after testing a few key combinations, they do not work. Try a 3rd party utility, such as, LockXP, to do the system locking. I got that from here.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@JdeB

For some reason {LWINUP} does not work, I tested that exact line of code and thought it worked but for some reason the Win key stays depressed.

*** Matt @ MPCS

Edit: Are you running XP Home or Pro? according to some documentation I read on the net, WinKey + L isn't supposed to work in Home.

Edited by Matt @ MPCS

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@nova

According to the online documentation:

But after testing a few key combinations, they do not work. Try a 3rd party utility, such as, LockXP, to do the system locking. I got that from here.

*** Matt @ MPCS

<{POST_SNAPBACK}>

doesn't this work for you ??? It does work on my XP:

Send("{LWINDOWN}l{LWINUP}")

Edit: ah... let me try again.... didn't notice that it remained pressed....

Edit2: yeap you are right....

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

@CyberSlug

Now that one works :ph34r:

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

Run("rundll32.exe user32.dll,LockWorkStation")

<{POST_SNAPBACK}>

knew i saw it before in the forum ... just couldn't find it....

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Just what I was looking for tnx cyber

Share this post


Link to post
Share on other sites

Do we know why the Winkey remains depressed or is there a workaround outside of using the DLL call? I tried sending a {LWINUP} and a {RWINUP} but neither 'unstuck' the Winkey. I had to manually depress the Winkey to get it to reset.

BTW, using WinXP Pro and the latest AI.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Seems too obvious, but did you try:

Send("#l")

That works fine for me on XP SP2. (the second character is a lowercase L, not a 1)

Edited by Sokko

Share this post


Link to post
Share on other sites

Yes, that was my first attempt. Second one was Send("{LWINDOWN}l{LWINUP}"). Both times the WinKey got stuck on and I had to manually depress the WinKey to 'unstick' it.

I'm using XP Pro SP2 as well.

Share this post


Link to post
Share on other sites

Huh, you're right. The first time I tried my above code, it seemed to work fine, and I carried on doing what I was doing before without noticing whether the key was stuck. The strange thing is, you'd think I would have hit a key while typing that would trigger a Windows key combination. Perhaps it gets unstuck when pressing some other keys, or it unsticks itself over time.

Of course, now that I'm deliberately testing to see whether it gets stuck down, I can see that it does. Weird.

Share this post


Link to post
Share on other sites

Cool, as I'm not the only one still having problems with the WinKey, it's either a Windows bug or an AutoIt one.

Share this post


Link to post
Share on other sites

i had tried to this a while back too. I just assumed that the releasing of the windows key was stopped because the user was logged off and that that stopped or messed up the script for a short while. That was just what I had assumed though. You could write something that releases the windows key once anyone logs back onto that computer. I think that could work but i'm not sure if the windows key can do anything while you are on the login screen. hmmm...

Share this post


Link to post
Share on other sites

Yeah, I too thought that may have something to do with it so I tried sending a LWINUP and a RWINUP after the user unlocks the computer but it didnt work - the Winkey was still depressed. Only manually depressing the Winkey unstuck it and since not every keyboard has a Winkey, this became a problem in that I couldn't just ask the user to "Press the Winkey" in a message box after they had unlocked the computer.

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