Sign in to follow this  
Followers 0
sublimnl

Better way to Undock laptop

6 posts in this topic

I have a script that I have written that sits in my systray and provides me with 4 options: Dock, Undock, Undock and Hibernate, and Hibernate. This was originally done to make the repetitive task of docking/undocking my laptop and having to constantly configure all my external monitors (3) and screen resolutions one by one.

The one snag I have is that I am using the Send command to send keys ({start}E) in order to tell Windows to undock my laptop. This doesn't seem to work about half the time and the laptop just sits there instead of going through with whatever undock voodoo that Windows does. I then go and click "Undock Computer" from the start menu manually and then Windows finally does its thing, monitors go dim and the ethernet adapter on the dock shows disconnected status. Does anyone know of a better way to initiate the Windows undock sequence programatically so that I can get consistent results from this script?

Thanks!

Share this post


Link to post
Share on other sites



I'm unsure as what dock/un-dock a laptop is but is there a potential to just run the program that is a shortcut in your start menu with some parameters ?

Share this post


Link to post
Share on other sites

I'm unsure as what dock/un-dock a laptop is but is there a potential to just run the program that is a shortcut in your start menu with some parameters ?

Undocking refers to whatever process Windows takes to gracefully disconnect the hardware that is part of a laptops docking station before you physically remove it from the dock. Unfortunately it is not a shortcut. It's a system command of some sort...situated below the first seperator along with the "Shut Down..." and "Log off" commands.

Share this post


Link to post
Share on other sites

anyone?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

resurrecting an old thread of mine. anyone have any ideas as to how i can programatically undock a laptop?

EDIT: I just found this VBS script that allegedly does the job. I'm not at work to test right now though. Anyone know what this script does and how to do the same in AutoIt?

Set wshshell = CreateObject("Shell.Application")
wshshell.EjectPC
Edited by sublimnl

Share this post


Link to post
Share on other sites

you can use the same object in autoit.

$shell = ObjCreate('Shell.Application')
$shell.EjectPC

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