English Community

Lenovo NotebooksLenovo Yoga Series Notebooks
All Forum Topics
Options

5 Posts

05-26-2014

israel

16 Signins

114 Page Views

  • Posts: 5
  • Registered: ‎05-26-2014
  • Location: israel
  • Views: 114
  • Message 81 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 17:03 PM

no scripts, no nothing.

it's not the TOUCH! it's the mouse!!!!! so... when closin the lid, press F6 to cancel the mouse. it's wprking for me.

Reply
Options

82 Posts

02-08-2014

US

69 Signins

573 Page Views

  • Posts: 82
  • Registered: ‎02-08-2014
  • Location: US
  • Views: 573
  • Message 82 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 17:26 PM
As I said before... that DOESN'T SOLVE THE PROBLEM. Some of us use the
computer while the lid is closed, via a larger monitor.
Reply
Options

1659 Posts

08-14-2011

USA

1886 Signins

25513 Page Views

  • Posts: 1659
  • Registered: ‎08-14-2011
  • Location: USA
  • Views: 25513
  • Message 83 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 17:52 PM

There are 2 types of people:

 

1. Those who want to disable the mouse/touch screen/keyboard (when the computer is put to sleep),  to avoid the computer from waking up and baking inside their bags.

 

 

2. The minority who jumped on this thread requesting something special. Which, for the record, is off topic.

 

 

To appease everyone, here you go:

 

Group # 1:

 

Download DevManView

 

Script:

 

OnMessage(0x218, "func_WM_POWERBROADCAST")
Return


func_WM_POWERBROADCAST(wParam, lParam)
{

    
    If (lParam = 0) {
        ;PBT_APMSUSPEND or PBT_APMSTANDBY? -> System will sleep
        If (wParam = 4 OR wParam = 5) {

            ;Script
                Run DevManView\DevManView.exe /disable "HID-compliant touch screen"

                [..... do the same for the rest]

            ;Script


            }
        
        
        ;PBT_APMRESUMESUSPEND oder PBT_APMRESUMESTANDBY? -> System wakes up
        If (wParam = 7 OR wParam = 8) {

            ;Script
                Run DevManView\DevManView.exe /disable "HID-compliant touch screen"

                [..... do the same for the rest]

            ;Script

            }
        }
    }
    Return

 

 

 

 

 

 

Group # 2:

Also Download DevManView

 

Main Script:

 

#Include LidWatcher.ahk
r := Start_LidWatcher()  ;Start waiting for the lid to be opened or closed

OnExit, cleanup
return

cleanup:
  Stop_LidWatcher(r)  ;Stop watching the lid state changes
  ExitApp
return



LidStateChange(newstate)
{
  [DevManView Disable Cmd]
}



Dependency :: LidWatcher.ahk code:

/*
 By Linear Spoon
   7/28/2013
 This script should work for Vista+

 Details:
 Use Start_LidWatcher to begin monitoring the lid state.
 r := Start_LidWatcher()

 When the state changes, the function "LidStateChange" will be called.
 LidStateChange should have the following format:
 LidStateChange(newstate)
 {
   ...
 }

 newstate will be one of two values:
 "opened" = The lid was opened
 "closed" = The lid was closed

 Note: It's possible that this function will be immediately called after
       using Start_LidWatcher with the lid's current state (usually open).

 When the application no longer needs to monitor the lid state,
 call Stop_LidWatcher with the return value from Start_LidWatcher.
 Pass it the return value from Start_LidWatcher.
 Stop_LidWatcher(r)

*/

Start_LidWatcher()
{
  VarSetCapacity(guid, 16)
  ;GUID_LIDSWITCH_STATE_CHANGE
  Numput(0xBA3E0F4D, guid, 0, "uint"), Numput(0x4094B817, guid, 4, "uint")
  Numput(0x63D5D1A2, guid, 8, "uint"), Numput(0xF3A0E679, guid, 12, "uint")

  r := DllCall("RegisterPowerSettingNotification", "ptr", A_ScriptHwnd, "ptr", &guid, "uint", 0)
  if (!r || ErrorLevel)
  {
    ;MSDN says check GetLastError if the return value was NULL.
    Msgbox % "RegisterPowerSettingNotification failed with error: " (ErrorLevel ? ErrorLevel : A_LastError)
    return 0
  }
  OnMessage(0x218, "WM_POWERBROADCAST")
  return r
}

Stop_LidWatcher(r)
{
  DllCall("UnregisterPowerSettingNotification", "ptr", r)
  OnMessage(0x218, "")
}

WM_POWERBROADCAST(wparam, lparam)
{
  static fx := "LidStateChange"
  if (wparam = 0x8013)
  {
    ;data = 0 = closed
    ;data = 1 = opened
    if isFunc(fx)    
      %fx%(Numget(lparam+20, 0, "uchar") ? "opened" : "closed")
  }
  return 1
}

 

 

 

 

 

 

Is everyone happy now?

Reply
Options

82 Posts

02-08-2014

US

69 Signins

573 Page Views

  • Posts: 82
  • Registered: ‎02-08-2014
  • Location: US
  • Views: 573
  • Message 84 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 18:00 PM
Hi
Can you explain where we would put this code?

Thanks
Cindi
Reply
Options

1659 Posts

08-14-2011

USA

1886 Signins

25513 Page Views

  • Posts: 1659
  • Registered: ‎08-14-2011
  • Location: USA
  • Views: 25513
  • Message 85 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 18:05 PM

which group are you?

 

 

Also, you will need to look into AHK: http://www.autohotkey.com/

Reply
Options

82 Posts

02-08-2014

US

69 Signins

573 Page Views

  • Posts: 82
  • Registered: ‎02-08-2014
  • Location: US
  • Views: 573
  • Message 86 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 18:06 PM
Group 2 (turn the screen off when the lid is closed but leave the
computer on)
Reply
Options

1659 Posts

08-14-2011

USA

1886 Signins

25513 Page Views

  • Posts: 1659
  • Registered: ‎08-14-2011
  • Location: USA
  • Views: 25513
  • Message 87 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 18:13 PM

 

First and foremost: Install AHK

 

Open notepad:

 

Paste this in:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


/*
 By Linear Spoon
   7/28/2013
 This script should work for Vista+

 Details:
 Use Start_LidWatcher to begin monitoring the lid state.
 r := Start_LidWatcher()

 When the state changes, the function "LidStateChange" will be called.
 LidStateChange should have the following format:
 LidStateChange(newstate)
 {
   ...
 }

 newstate will be one of two values:
 "opened" = The lid was opened
 "closed" = The lid was closed

 Note: It's possible that this function will be immediately called after
       using Start_LidWatcher with the lid's current state (usually open).

 When the application no longer needs to monitor the lid state,
 call Stop_LidWatcher with the return value from Start_LidWatcher.
 Pass it the return value from Start_LidWatcher.
 Stop_LidWatcher(r)

*/

Start_LidWatcher()
{
  VarSetCapacity(guid, 16)
  ;GUID_LIDSWITCH_STATE_CHANGE
  Numput(0xBA3E0F4D, guid, 0, "uint"), Numput(0x4094B817, guid, 4, "uint")
  Numput(0x63D5D1A2, guid, 8, "uint"), Numput(0xF3A0E679, guid, 12, "uint")

  r := DllCall("RegisterPowerSettingNotification", "ptr", A_ScriptHwnd, "ptr", &guid, "uint", 0)
  if (!r || ErrorLevel)
  {
    ;MSDN says check GetLastError if the return value was NULL.
    Msgbox % "RegisterPowerSettingNotification failed with error: " (ErrorLevel ? ErrorLevel : A_LastError)
    return 0
  }
  OnMessage(0x218, "WM_POWERBROADCAST")
  return r
}

Stop_LidWatcher(r)
{
  DllCall("UnregisterPowerSettingNotification", "ptr", r)
  OnMessage(0x218, "")
}

WM_POWERBROADCAST(wparam, lparam)
{
  static fx := "LidStateChange"
  if (wparam = 0x8013)
  {
    ;data = 0 = closed
    ;data = 1 = opened
    if isFunc(fx)    
      %fx%(Numget(lparam+20, 0, "uchar") ? "opened" : "closed")
  }
  return 1
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

Call that: LidWatcher.ahk

 

Make sure notepad does not save it as a txt file. If it does, just rename the file and delete the txt (it has to end in ahk).

 

Now you have the lib you need for your project. Now make your script:

 

Script.ahk

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#Include LidWatcher.ahk
r := Start_LidWatcher()  ;Start waiting for the lid to be opened or closed

OnExit, cleanup
return

cleanup:
  Stop_LidWatcher(r)  ;Stop watching the lid state changes
  ExitApp
return



LidStateChange(newstate)
{
  [DevManView Disable Cmd]
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

 

Replace [DevManView Disable Cmd] with the command you want..... Example:

 

Run DevManView\DevManView.exe /disable "HID-compliant touch screen"

 

To use this command, you will also need to download a program called DevManView and place it in a folder called DevManView, or just delete the stuff before Devmanview.exe

 

Other commands can be found:

http://www.autohotkey.com/docs/commands.htm

 

 

Run the script to see if you get any errors. If it works like a charm, right click on the script and select compile to exe.

 

Reply
Options

5 Posts

05-26-2014

israel

16 Signins

114 Page Views

  • Posts: 5
  • Registered: ‎05-26-2014
  • Location: israel
  • Views: 114
  • Message 88 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 18:32 PM

these solutions are not even close to what i gonna do with my Y2P.

if it's a windows 8.1 problam, they should update the system,

yet, lenovo have this great app installed in the Y2P "lenovo transition", well, UPGRADE THIS APP SO IT WILL KNOW THAT THE LID IS CLOSED!

 

you guys are a huge joke.(lenovo)

 

Moderator Note; profanity / implied profanity edited. Keep it clean!  Forum Rules

Reply
Options

1659 Posts

08-14-2011

USA

1886 Signins

25513 Page Views

  • Posts: 1659
  • Registered: ‎08-14-2011
  • Location: USA
  • Views: 25513
  • Message 89 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-06-11, 18:42 PM
This is probably the best you are gonna get. It is simple to do..... Anyhow, gotta work, peace guys.
Reply
Options

1659 Posts

08-14-2011

USA

1886 Signins

25513 Page Views

  • Posts: 1659
  • Registered: ‎08-14-2011
  • Location: USA
  • Views: 25513
  • Message 90 of 102

Re: Yoga 2 Pro wakes up when lid is closed

2014-09-06, 14:13 PM

My laptop now experinces this problem, out of the blue. Any fixes? ...or must I create my own?

 

Never mind. I found my problem: 

 

 


System Availability Requests: System Required Request
The program has made a request to prevent the system from automatically entering sleep.
Requesting Process\Device\HarddiskVolume5\Program Files (x86)\VideoLAN\VLC\vlc.exe


I am just an idiot -.-

 

If you want to find the bad boy that is keeping your laptop from sleeping at night, use the "powercfg -energy" command in cmd.

Reply
Forum Home

Community Guidelines

Please review our Guidelines before posting.

Learn More

Check out current deals!

Go Shop
X

Save

X

Delete