I'm using 2 scripts:
Code: Select all
#SingleInstance Force
Loop 600
{
ToolTip, % 601 - A_Index ; if you just use A_Index it starts at 1 2 3 etc
Sleep 1000
}
Tooltip, 0
Code: Select all
#Persistent
#NoEnv
#SingleInstance Force
SetBatchLines -1
SetWorkingDir %A_ScriptDir%
p0:="red.png",p1:="green.png"
UrlDownloadToFile, https://www.autohotkey.com/boards/download/file.php?id=12973,% p0
UrlDownloadToFile, https://www.autohotkey.com/boards/download/file.php?id=12972,% p1
Run %A_AhkPath% "C:\[path]\[script].ahk"
SetTimer Countdown,600000
Grd:=[1,1,0,0,1 ;Initial board matrix/layout.
,0,1,1,1,0
,1,0,0,1,0
,1,0,0,0,1
,0,1,1,0,0]
Gui Brd:New,+ToolWindow ;Create/display board Gui.
ct:=1
Loop 5{
ly:=(A_Index-1)*31
Loop 5{
lx:=(A_Index-1)*31
Gui Add,Picture,x%lx% y%ly% w30 h30 gClk v%ct%,% Grd[ct]?p1:p0
ct++
}
}
Gui Show,w154 h154
Return
Countdown:
ExitApp
Clk: ;Get what was clicked:
pr:=A_GuiControl
If (pr=1) ;Top Lft
cc:="00111"
Else If (pr=5) ;Top Rgt
cc:="01101"
Else If (pr=21) ;Bot Lft
cc:="10110"
Else If (pr=25) ;Bot Rgt
cc:="11100"
Else If (pr>1 && pr<5) ;Top Mid
cc:="01111"
Else If (pr>21 && pr<25) ;Bot Mid
cc:="11110"
Else If (Mod(pr-1,5)=0) ;Lft Mid
cc:="10111"
Else If (Mod(pr,5)=0) ;Rgt Mid
cc:="11101"
Else ;Mid Mid
cc:="11111"
; cc = "Top/Left/Middle/Right/Bottom"
Loop Parse,cc
{
If (A_Index=1 && A_LoopField=1){
Grd[pr-5]:=!Grd[pr-5]
GuiControl ,,% pr-5,% Grd[pr-5]?p1:p0
}
If (A_Index=2 && A_LoopField=1){
Grd[pr-1]:=!Grd[pr-1]
GuiControl ,,% pr-1,% Grd[pr-1]?p1:p0
}
If (A_Index=3 && A_LoopField=1){
Grd[pr]:=!Grd[pr]
GuiControl ,,% pr,% Grd[pr]?p1:p0
}
If (A_Index=4 && A_LoopField=1){
Grd[pr+1]:=!Grd[pr+1]
GuiControl ,,% pr+1,% Grd[pr+1]?p1:p0
}
If (A_Index=5 && A_LoopField=1){
Grd[pr+5]:=!Grd[pr+5]
GuiControl ,,% pr+5,% Grd[pr+5]?p1:p0
}
}
Return
BrdGuiClose:
ExitApp
!5::Reload
1) I want to close (ExitApp) the GUI (so the grid window) along with the tooltip script whenever i hit the red X on the GUI.
Well preferably these 2 scripts can be made into 1 instead i think but I don't know how.
2) The other thing is, I noticed that the tooltip on the mouse covers the GUI meaning it prevents the click on the grid window. So I came up with an idea that attaches the tooltip next to the red X of the grid window (shown in file attachment) If the tooltip was attached to the window instead of the mouse and is movable around so the tooltip stays on that spot next to the X , that would be nice.
And I'll be forever thankful of anyone providing a solution!