AutoHotkey Community

It is currently May 26th, 2012, 11:42 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: November 7th, 2009, 6:01 am 
Hey guys,

I'm trying to create a script to show/hide the default windows battery meter but I'm having trouble, namely because I don't really know what I'm doing.

So far I have


F1::
WinActivate ahk_class BatMeterFlyout
return

but that doesn't work. I'm not sure why - thats what I got for the battery meter from window spy. can anybody help?

cheers

jonny


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 10:26 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
Sam ? jonny ?

Code:
#Persistent
#SingleInstance, Force

;====================================
; Note: this program creates an INI file
;====================================
CoordMode, ToolTip, screen
CoordMode, Mouse, screen
CoordMode, Pixel, screen

StringGetPos, OutputVar, A_ScriptName, .
StringMid, title, A_ScriptName, 1 , OutputVar ; remove the AHK or EXE
inifile:=title ".ini"

; This example allows you to move the mouse around to see
; the title of the window currently under the cursor:

IfnotExist, %inifile%
{
  msgbox Move mouse cursor the battery power icon & press F1
  SetTimer, WatchCursor, 100
  return
}
else
{
  msgbox Press F1 to show battery meter
  return
}

return ; <-- just in case


WatchCursor:
MouseGetPos, xpos, ypos
ToolTip, %xpos%   %ypos%
return

f1::
  IfExist, %inifile%
  {
   ; msgbox
    IniRead, xpos, %inifile%, battery, xpos
    IniRead, ypos, %inifile%, battery, ypos
   ;    msgbox battery power icon is at x%xpos% y%ypos%`nDelete %inifile% to change location
    MouseGetPos, xnow, ynow

    mousemove, %xpos%, %ypos%, 10
    click
    sleep, 2000
    mousemove, xpos-20, %ypos%, 10
    click
    Mousemove, xnow, ynow ,10

    return   
  }
  else
  {
    IniWrite, %xpos%, %inifile%, battery, xpos
    IniWrite, %ypos%, %inifile%, battery, ypos

    reload ; <--- location set, reload script
  }

return


esc::  ; <--- in case of emergency, press escape
exitapp



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 12:00 pm 
thanks, but that script doesn't work for me. when i press F1 nothing happens. I'd like to try and find a way of activating the default windows battery meter if i can, just a show hide function for the flyout window


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 6:32 pm 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
Quote:
but that script doesn't work for me.

That's like saying "the car doesn't work for me."

Do you not like the color ? :wink:

Where does it not work ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 11:13 pm 
sam__ wrote:
thanks, but that script doesn't work for me. when i press F1 nothing happens. I'd like to try and find a way of activating the default windows battery meter if i can, just a show hide function for the flyout window


Can somebody please help me? The ahk_class is BatMeterFlyout but for some reason WinActivate doesn't work

Cheers,

Sam__


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2009, 4:32 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
Did you try to follow the instructions in my script ?
They are rather simple and only need to be done once.
Quote:
msgbox Move mouse cursor the battery power icon & press F1

I just did a google search for that name and came with 2 hits, yours and one at support.fogcreek.com.
There doesn't seem to be any control of it by VBA or other code.
Again, it seems that clicking the icon is the only way to show the window.

Have you found some other way to manually show the window?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, Leef_me, Pulover, rbrtryn, XstatyK, Yahoo [Bot] and 31 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group