yash Posted October 4, 2006 Share Posted October 4, 2006 Mains_Check.au3 Hi, Please anyone can help me in how to check that the Laptop is in Battery or in AC power? i had written one script that check it but it does not go in loop i.e. after clicking on OK button it is not checking again that the Laptop is in Mains or AC power. Here is my script...... #include <Process.au3> run("control.exe","C:\WINDOWS\system32",@SW_HIDE) sleep(1000) $a = Call("Power") Func Power() sleep(500) Send("{ASC 080}") Send("{ASC 080}") Send("{ENTER}") sleep(1000) send("^{TAB}") send("^{TAB}") $text = WinGetText("Power Options Properties") $var = StringInStr ( $text, "AC power") sleep(1000) WinKill ( "Power Options Properties") sleep(500) WinClose ( "Control Panel") sleep(500) if $var = 0 THEN MsgBox(0, "", "Please connect your Laptop to Mains") $b=MsgBox(4, "", "Have you connected your Laptop to Mains") if $b=7 then exit return 0 Endif Else MsgBox(0, "", "Laptop connected to Mains") return 1 EndIf EndFunc I had tried so many options but unable to do it? Please help me what to do?SHould anyone suggest any other way to do this? Thanks Yash Link to comment Share on other sites More sharing options...
Confuzzled Posted October 7, 2006 Share Posted October 7, 2006 Can't you find the details using the AutoIT Scriptomatic utility (search for it in the forums) to examine the WMI status? Link to comment Share on other sites More sharing options...
this-is-me Posted October 7, 2006 Share Posted October 7, 2006 *mumbles something about forum search*http://www.autoitscript.com/forum/index.php?showtopic=32319 Who else would I be? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now