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