Jump to content
eagle4life69

Detecting Dock state of laptop

Recommended Posts

eagle4life69

So I am looking to write something that would detect if a laptop is docked or not. I am thinking the simple way is to detect if a certain nic card is present since all of my docks have the same hardware device type for the nic.

What I need help with is how to make this work to read when the laptop is docked and undocked. and how to make the program run without eating memory I found sleeping isn't effective but maybe that's me

thanks for the help

UPDATE 1:
Maybe looking at the key will work better for docking. But how to make it know when the state changes from a 1 to a 2?

HKLM\SYSTEM\CurrentControlSet\Control\IDConfigDB\CurrentDockInfo\DockingState

 

Edited by eagle4life69

Share this post


Link to post
Share on other sites
JLogan3o13

@eagle4life69 Dog ate your help file? Look at RegRead in the help file.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
eagle4life69
3 minutes ago, JLogan3o13 said:

@eagle4life69 Dog ate your help file? Look at RegRead in the help file.

I understand how to read the registry but how do I loop it over and over again? so about 1000 checks a minute?

at some point would I not just eat memory? I'm looking for better programming than just doing a while loop with a sleep(50)

Edited by eagle4life69

Share this post


Link to post
Share on other sites
JLogan3o13

Maybe a While Loop?

While RegRead(<KeyName>, <ValueName>) = "Value"
    Sleep(100)
WEnd

MsgBox(0, "", "Value Changed!")

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
eagle4life69
6 minutes ago, JLogan3o13 said:

Maybe a While Loop?

While RegRead(<KeyName>, <ValueName>) = "Value"
    Sleep(100)
WEnd

MsgBox(0, "", "Value Changed!")

 

I will try that my concern is if it runs 24/7 how much memory would it eat thanks for the help

 

Share this post


Link to post
Share on other sites
TheDcoder

It shouldn't eat memory, it would reuse a limited amount.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites
eagle4life69
On 10/31/2017 at 0:01 AM, TheDcoder said:

It shouldn't eat memory, it would reuse a limited amount.

OK I will run some tests I appreciate the comments

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.