 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sam__ Guest
|
Posted: Sat Nov 07, 2009 5:01 am Post subject: Show/Hide Battery Meter Script |
|
|
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 |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Sat Nov 07, 2009 9:26 am Post subject: |
|
|
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
|
|
|
| Back to top |
|
 |
sam__ Guest
|
Posted: Sat Nov 07, 2009 11:00 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Sat Nov 07, 2009 5:32 pm Post subject: |
|
|
| 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 ?
Where does it not work ? |
|
| Back to top |
|
 |
Sam__ Guest
|
Posted: Sat Nov 07, 2009 10:13 pm Post subject: |
|
|
| 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__ |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 1158 Location: San Diego, California
|
Posted: Sun Nov 08, 2009 3:32 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|