MPT
MPT

Reputation: 51

How to use script with laptop lid closed?

So I have a script which works perfectly fine.

Here it is:

#SingleInstance force
#Persistent
settimer, idleCheck, 1000 ; check every second
return

idleCheck:
if WinExist("App Name with or without Spaces") ; if app is running
{
    if(A_TimeIdle >= 270000) ; and there was no input in 4.5 min
    {
        WinActivate ; switch to that app
        sendInput z ; and perform an action
    }
}
return 

But as soon as lid is closed (not in sleep) it doesn't for obvious reasons.

Is there a way to do stuff when it's closed or "trick" OS to think that lid is open when it's closed.

Hope that makes sense.

Solution doesn't have to be in .ahk only. I just need the script to work, with which help doesn't matter.

Thanks in advance.

Upvotes: 4

Views: 2436

Answers (1)

blackholyman
blackholyman

Reputation: 1450

This is under the assumption that your laptop does go into some kind of 'sleep mode' when the lid is shut.

If thats the case, I don't think you need an AHK script for this.

If you go to the power settings options in your control panel.. Most of the time it looks something like this: enter image description here


  You may need to find the advanced power options, sometimes found under power plans... enter image description here  

I hope it's fairly self explanatory what you need to do.

Just pick 'do nothing' or similar for the lid close action.

After that everything should continue running as if the lid was open.

Upvotes: 5

Related Questions