Hex Calc and Cube Calc

Post your working scripts, libraries and tools
x32
Posts: 85
Joined: 25 Nov 2016, 16:44

Hex Calc and Cube Calc

11 Apr 2018, 15:47

This is more of an experiment than something I expect people will find useful. It's an odd shaped calculator with hexagon buttons. Each button is it's own gui, all are linked together with DockA. Eval is used for calculating.

The script, all libraries, and images can be downloaded in the zip file. Hex_Calc.7z

Image

Click here to see Cube Calc.

Code: Select all

; #Warn  ; Enable warnings to assist with detecting common errors.
#NoEnv  
SendMode Input 
SetWorkingDir %A_ScriptDir%  
#SingleInstance, Force
DetectHiddenWindows, On
DetectHiddenText, On
Gui, Margin, 5, 5
Gui, Color, aabbcc

Gui, Font, cBlack s12, Tahoma
Gui, -Caption +AlwaysOnTop +LastFound 
SetTitleMatchMode 2
DetectHiddenWindows, On
DetectHiddenText, On

Gui, Add, Pic, x105 y47 w31 h31 +0x800000 gmove, move.png 
Gui, Add, Edit, x155 y47 w190 Right vedit1,
Gui, Add, Pic, x360 y47 w31 h31 +0x800000 gExit, exit.png

Gui, Add, Button, x155 y75 w50 h25 ghelp, Help
Gui, Add, Button, x295 y75 w50 h25 gclear, Clear

WinSet, TransColor, aabbcc, Hex Calc
Gui, Show, w500 h500 , Hex Calc 

GoSub, win2
GoSub, win3
GoSub, win15
GoSub, win16
GoSub, win5
GoSub, win9
GoSub, win8
GoSub, win4
GoSub, win14
GoSub, win18
GoSub, win21
GoSub, win19
GoSub, win20
GoSub, win17
GoSub, win6
GoSub, win10
GoSub, win13
GoSub, win12
GoSub, win11
GoSub, win7
GoSub, docks
GuiControl, 1:Focus, Edit1 
Return 

win2:   ;  6
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+215
wi := PY+222
GUI_ID:=WinExist()
Gui, 2:Font, s20
Gui, 2:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 2:Add, Pic, x0 y0 w72 h70 vb6 gb6, oct.png
Gui, 2:Add, Text, x30 y20 BackgroundTrans gb6, 6
Gui, 2:Show, w72 h72 x%ecks% y%wi%, win2
Gui, 2:Color, aabbcc
WinSet, TransColor, aabbcc, win2
Return

win3:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+215
wi := PY+150
GUI_ID:=WinExist()
Gui, 3:Font, s20
Gui, 3:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 3:Add, Pic, x0 y0 w72 h70 vb9 gb9, oct.png
Gui, 3:Add, Text, x30 y20 BackgroundTrans gb9, 9
Gui, 3:Show, w72 h72 x%ecks% y%wi%, win3
Gui, 3:Color, aabbcc
WinSet, TransColor, aabbcc, win3
Return

win4:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+215
wi := PY+78
GUI_ID:=WinExist()
Gui, 4:Font, s20
Gui, 4:+AlwaysOnTop -Caption +LastFound +Owner1 +E0x08000000
Gui, 4:Add, Pic, x0 y0 w72 h70 vbdel gbdel, oct.png
Gui, 4:Add, Text, x15 y20 BackgroundTrans gbdel, Del
Gui, 4:Show, w72 h72 x%ecks% y%wi%, win4
Gui, 4:Color, aabbcc
WinSet, TransColor, aabbcc, win4
Return

win5: 
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+215
wi := PY+294
GUI_ID:=WinExist()
Gui, 5:Font, s20
Gui, 5:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 5:Add, Pic, x0 y0 w72 h70 vb3 gb3, oct.png
Gui, 5:Add, Text, x30 y20 BackgroundTrans gb3, 3
Gui, 5:Show, w72 h72 x%ecks% y%wi%, win5
Gui, 5:Color, aabbcc
WinSet, TransColor, aabbcc, win5
Return

win6:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+215
wi := PY+366
GUI_ID:=WinExist()
Gui, 6:Font, s20
Gui, 6:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 6:Add, Pic, x0 y0 w72 h70 vb0 gb0, oct.png
Gui, 6:Add, Text, x30 y20 BackgroundTrans gb0, 0
Gui, 6:Show, w72 h72 x%ecks% y%wi%, win6
Gui, 6:Color, aabbcc
WinSet, TransColor, aabbcc, win6
Return

win7:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+157
wi := PY+114
GUI_ID:=WinExist()
Gui, 7:Font, s20
Gui, 7:+AlwaysOnTop -Caption +LastFound +Owner1 +E0x08000000 
Gui, 7:Add, Pic, x0 y0 w72 h70 vbbs gbbs, oct.png
Gui, 7:Add, Text, x17 y20 BackgroundTrans gbbs, BS
Gui, 7:Show, w72 h72 x%ecks% y%wi% NoActivate, win7
Gui, 7:Color, aabbcc
WinSet, TransColor, aabbcc, win7
Return

win8:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+157
wi := PY+186
GUI_ID:=WinExist()
Gui, 8:Font, s20
Gui, 8:+AlwaysOnTop -Caption +LastFound +Owner1 
Gui, 8:Add, Pic, x0 y0 w72 h70 vb8 gb8, oct.png
Gui, 8:Add, Text, x30 y20 BackgroundTrans gb8, 8
Gui, 8:Show, w72 h72 x%ecks% y%wi%, win8
Gui, 8:Color, aabbcc
WinSet, TransColor, aabbcc, win8
Return

win9:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+157
wi := PY+258
GUI_ID:=WinExist()
Gui, 9:Font, s20
Gui, 9:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 9:Add, Pic, x0 y0 w72 h70 vb5 gb5, oct.png
Gui, 9:Add, Text, x30 y20 BackgroundTrans gb5, 5
Gui, 9:Show, w72 h72 x%ecks% y%wi%, win9
Gui, 9:Color, aabbcc
WinSet, TransColor, aabbcc, win9
Return

win10:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+157
wi := PY+330
GUI_ID:=WinExist()
Gui, 10:Font, s20
Gui, 10:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 10:Add, Pic, x0 y0 w72 h70 vb2 gb2, oct.png
Gui, 10:Add, Text, x30 y20 BackgroundTrans gb2, 2
Gui, 10:Show, w72 h72 x%ecks% y%wi%, win10
Gui, 10:Color, aabbcc
WinSet, TransColor, aabbcc, win10
Return

win11:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+99
wi := PY+150
GUI_ID:=WinExist()
Gui, 11:Font, s20
Gui, 11:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 11:Add, Pic, x0 y0 w72 h70 vb7 gb7, oct.png
Gui, 11:Add, Text, x30 y20 BackgroundTrans gb7, 7
Gui, 11:Show, w72 h72 x%ecks% y%wi%, win11
Gui, 11:Color, aabbcc
WinSet, TransColor, aabbcc, win11
Return

win12:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+99
wi := PY+222
GUI_ID:=WinExist()
Gui, 12:Font, s20
Gui, 12:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 12:Add, Pic, x0 y0 w72 h70 vb4 gb4, oct.png
Gui, 12:Add, Text, x30 y20 BackgroundTrans gb4, 4
Gui, 12:Show, w72 h72 x%ecks% y%wi%, win12
Gui, 12:Color, aabbcc
WinSet, TransColor, aabbcc, win12
Return

win13:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+99
wi := PY+294
GUI_ID:=WinExist()
Gui, 13:Font, s20
Gui, 13:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 13:Add, Pic, x0 y0 w72 h70 vb1 gb1, oct.png
Gui, 13:Add, Text, x30 y20 BackgroundTrans gb1, 1
Gui, 13:Show, w72 h72 x%ecks% y%wi%, win13
Gui, 13:Color, aabbcc
WinSet, TransColor, aabbcc, win13
Return

win14:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+273
wi := PY+114
GUI_ID:=WinExist()
Gui, 14:Font, s20
Gui, 14:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 14:Add, Pic, x0 y0 w72 h70 vbdiv gbdiv, oct.png
Gui, 14:Add, Text, x32 y20 BackgroundTrans gbdiv, /
Gui, 14:Show, w72 h72 x%ecks% y%wi%, win14
Gui, 14:Color, aabbcc
WinSet, TransColor, aabbcc, win14
Return

win15:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+273
wi := PY+186
GUI_ID:=WinExist()
Gui, 15:Font, s20
Gui, 15:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 15:Add, Pic, x0 y0 w72 h70 vbtimes gbtimes, oct.png
Gui, 15:Add, Text, x32 y27 BackgroundTrans gbtimes, *
Gui, 15:Show, w72 h72 x%ecks% y%wi%, win15
Gui, 15:Color, aabbcc
WinSet, TransColor, aabbcc, win15
Return

win16:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+273
wi := PY+258
GUI_ID:=WinExist()
Gui, 16:Font, s20
Gui, 16:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 16:Add, Pic, x0 y0 w72 h70 vbmin gbmin, oct.png
Gui, 16:Add, Text, x32 y20 BackgroundTrans gbmin, -
Gui, 16:Show, w72 h72 x%ecks% y%wi%, win16
Gui, 16:Color, aabbcc
WinSet, TransColor, aabbcc, win16
Return

win17:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+273
wi := PY+330
GUI_ID:=WinExist()
Gui, 17:Font, s20
Gui, 17:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 17:Add, Pic, x0 y0 w72 h70 vbadd gbadd, oct.png
Gui, 17:Add, Text, x30 y22 BackgroundTrans gbadd, +
Gui, 17:Show, w72 h72 x%ecks% y%wi%, win17
Gui, 17:Color, aabbcc
WinSet, TransColor, aabbcc, win17
Return

win18:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+331
wi := PY+150
GUI_ID:=WinExist()
Gui, 18:Font, s20
Gui, 18:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 18:Add, Pic, x0 y0 w36 h70 vbpl gbpl, octl.png
Gui, 18:Add, Text, x20 y20 BackgroundTrans gbpl, (
Gui, 18:Show, w36 h72 x%ecks% y%wi%, win18
Gui, 18:Color, aabbcc
WinSet, TransColor, aabbcc, win18
Return

win19:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+331
wi := PY+222
GUI_ID:=WinExist()
Gui, 19:Font, s20
Gui, 19:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 19:Add, Pic, x0 y0 w72 h70 vbdot gbdot, oct.png
Gui, 19:Add, Text, x32 y15 BackgroundTrans gbdot, .
Gui, 19:Show, w72 h72 x%ecks% y%wi%, win19
Gui, 19:Color, aabbcc
WinSet, TransColor, aabbcc, win19
Return

win20:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+331
wi := PY+294
GUI_ID:=WinExist()
Gui, 20:Font, s20
Gui, 20:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 20:Add, Pic, x0 y0 w72 h70 vbent gbent, oct.png
Gui, 20:Add, Text, x30 y22 BackgroundTrans gbent, =
Gui, 20:Show, w72 h72 x%ecks% y%wi%, win020
Gui, 20:Color, aabbcc
WinSet, TransColor, aabbcc, win020
Return

win21:
WinGetPos, PX, PY, Width, Height, Hex Calc
ecks := PX+366
wi := PY+150
GUI_ID:=WinExist()
Gui, 21:Font, s20
Gui, 21:+AlwaysOnTop -Caption +LastFound +Owner1
Gui, 21:Add, Pic, x0 y0  w36 h70 vbpr gbpr, octr.png
Gui, 21:Add, Text, x10 y20 BackgroundTrans gbpr, )
Gui, 21:Show, w36 h72 x%ecks% y%wi%, win021
Gui, 21:Color, aabbcc
WinSet, TransColor, aabbcc, win021
Return

clear:
GuiControl, 1:, Edit1,
Return

help:
IfWinExist, Hex Calc Help
	WinClose, Hex Calc Help
Else, Run, Hex Calc Help.ahk
Return


b6:   ; win2
Gui, 1:Submit, NoHide
OnPress("b6")
GuiControl, 1:, Edit1, %Edit1%6
Return

b9:   ; win3
Gui, 1:Submit, NoHide
OnPress("b9")
GuiControl, 1:, Edit1, %Edit1%9
Return

bdel:  ; win4
Gui, 1:Submit, NoHide
OnPress("bdel")
GuiControl, 1:Focus, Edit1 
Send, {Del} 
Return

b3:  ; win5
Gui, 1:Submit, NoHide
OnPress("b3")
GuiControl, 1:, Edit1, %Edit1%3
Return

b0:  ; win6
Gui, 1:Submit, NoHide
OnPress("b0")
GuiControl, 1:, Edit1, %Edit1%0
Return

bbs:  ; win7
Gui, 1:Submit, NoHide
OnPress("bbs")
GuiControl, 1:Focus, Edit1 
Send, {BS}
Return

b8:  ; win8
Gui, 1:Submit, NoHide
OnPress("b8")
GuiControl, 1:, Edit1, %Edit1%8
Return

b5:  ; win9
Gui, 1:Submit, NoHide
OnPress("b5")
GuiControl, 1:, Edit1, %Edit1%5
Return

b2:  ; win10
Gui, 1:Submit, NoHide
OnPress("b2")
GuiControl, 1:, Edit1, %Edit1%2
Return

b7:  ; win11
Gui, 1:Submit, NoHide
OnPress("b7")
GuiControl, 1:, Edit1, %Edit1%7
Return

b4:  ; win12
Gui, 1:Submit, NoHide
OnPress("b4")
GuiControl, 1:, Edit1, %Edit1%4
Return

b1:  ; win13
Gui, 1:Submit, NoHide
OnPress("b1")
GuiControl, 1:, Edit1, %Edit1%1
Return

bdiv:  ;win14
Gui, 1:Submit, NoHide
OnPress("bdiv")
GuiControl, 1:, Edit1, %Edit1%/
Return

btimes:  ;win15
Gui, 1:Submit, NoHide
OnPress("btimes")
GuiControl, 1:, Edit1, %Edit1%*
Return

bmin:  ;win16
Gui, 1:Submit, NoHide
OnPress("bmin")
GuiControl, 1:, Edit1, %Edit1%-
Return

badd:  ;win17
Gui, 1:Submit, NoHide
OnPress("badd")
GuiControl, 1:, Edit1, %Edit1%+
Return

bpl:  ;win18
Gui, 1:Submit, NoHide
GuiControl, , bpl, octld.png
Sleep, 100
GuiControl, , bpl, octl.png
GuiControl, 1:, Edit1, %Edit1%(
Return

bdot:  ;win19
Gui, 1:Submit, NoHide
OnPress("bdot")
GuiControl, 1:, Edit1, %Edit1%.
Return

bent:  ;win20
Gui, 1:Submit, NoHide
OnPress("bent")
total := Eval(edit1)
GuiControl, 1:, Edit1, %total%
Return

bpr:  ;win21
Gui, 1:Submit, NoHide
GuiControl, , bpr, octrd.png
Sleep, 100
GuiControl, , bpr, octr.png
GuiControl, 1:, Edit1, %Edit1%)
Return



docks:
WinGet, IDG1, ID, Hex Calc
WinGet, IDG2, ID, win2
DockA(IDG1, IDG2, "x(.43) y(.445) w() h()")

WinGet, IDG3, ID, win3
DockA(IDG1, IDG3, "x(.43) y(.3) w() h()")

WinGet, IDG4, ID, win4
DockA(IDG1, IDG4, "x(.43) y(.157) w() h()")

WinGet, IDG5, ID, win5
DockA(IDG1, IDG5, "x(.43) y(.589) w() h()")

WinGet, IDG6, ID, win6
DockA(IDG1, IDG6, "x(.43) y(.733) w() h()")

WinGet, IDG7, ID, win7
DockA(IDG1, IDG7, "x(.315) y(.229) w() h()")

WinGet, IDG8, ID, win8
DockA(IDG1, IDG8, "x(.315) y(.373) w() h()")

WinGet, IDG9, ID, win9
DockA(IDG1, IDG9, "x(.315) y(.517) w() h()")

WinGet, IDG10, ID, win10
DockA(IDG1, IDG10, "x(.315) y(.661) w() h()")

WinGet, IDG11, ID, win11
DockA(IDG1, IDG11, "x(.199) y(.3) w() h()")

WinGet, IDG12, ID, win12
DockA(IDG1, IDG12, "x(.199) y(.445) w() h()")

WinGet, IDG13, ID, win13
DockA(IDG1, IDG13, "x(.199) y(.589) w() h()")

WinGet, IDG14, ID, win14
DockA(IDG1, IDG14, "x(.547) y(.229) w() h()")

WinGet, IDG15, ID, win15
DockA(IDG1, IDG15, "x(.547) y(.373) w() h()")

WinGet, IDG16, ID, win16
DockA(IDG1, IDG16, "x(.547) y(.517) w() h()")

WinGet, IDG17, ID, win17
DockA(IDG1, IDG17, "x(.547) y(.661) w() h()")

WinGet, IDG18, ID, win18
DockA(IDG1, IDG18, "x(.663) y(.3) w() h()")

WinGet, IDG19, ID, win19
DockA(IDG1, IDG19, "x(.663) y(.445) w() h()")

WinGet, IDG020, ID, win020
DockA(IDG1, IDG020, "x(.663) y(.589) w() h()")

WinGet, IDG21, ID, win021
DockA(IDG1, IDG21, "x(.733) y(.3) w() h()")
Return

move:
PostMessage, 0xA1, 2,,, A
Return

Exit:
GuiEscape:
GuiClose:
Sleep, 100
Gui, Destroy
ExitApp
Return

OnPress(dDown)
	{
	GuiControl, , %dDown%, octd.png
	Sleep, 100
	GuiControl, , %dDown%, oct.png
	}
Last edited by x32 on 13 Apr 2018, 10:13, edited 1 time in total.
wolf_II
Posts: 2242
Joined: 08 Feb 2015, 20:55

Re: Hex Calc

11 Apr 2018, 17:29

:bravo: :thumbup: Nice!
After looking closer, I noticed all *.png files have a height of 72, and in code you resize them to h70. This causes the edges to be smeared out.
I tried with searching for h70 and replacing with h72, which seems to clean the edges for me. Is there any reason not to do so?

Thanks for sharing.
x32
Posts: 85
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

11 Apr 2018, 17:50

wolf_II wrote:After looking closer, I noticed all *.png files have a height of 72, and in code you resize them to h70. This causes the edges to be smeared out.
I tried with searching for h70 and replacing with h72, which seems to clean the edges for me. Is there any reason not to do so?.
No reason they can't be set back to 72. I changed it because the images looked taller than their width and it fixed a spacing issue.
burque505
Posts: 681
Joined: 22 Jan 2017, 19:37

Re: Hex Calc

11 Apr 2018, 17:57

Very nice indeed, thank you.
Thank you for sharing this with us.
Bravo!
User avatar
kczx3
Posts: 692
Joined: 06 Oct 2015, 21:39

Re: Hex Calc

11 Apr 2018, 18:11

Why use separate guis?
x32
Posts: 85
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

11 Apr 2018, 20:35

kczx3 wrote:Why use separate guis?
It's the only way I could find to use the odd shaped buttons. Even if I used pics with transparent backgrounds they are still square. If the transparent corner of one button is on top of another button the transparent corner receives the click.
User avatar
BGM
Posts: 419
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: Hex Calc

11 Apr 2018, 21:49

Very interesting! Thanks for sharing!
User avatar
SpeedMaster
Posts: 235
Joined: 12 Nov 2016, 16:09

Re: Hex Calc

12 Apr 2018, 06:57

Very interesting :clap:
x32 wrote:
kczx3 wrote:Why use separate guis?
It's the only way I could find to use the odd shaped buttons. Even if I used pics with transparent backgrounds they are still square. If the transparent corner of one button is on top of another button the transparent corner receives the click.
In theory it is possible take a pixel location (such as a mouse click) and convert it into a hex grid coordinate.
for those who are interested here is a tutorial (maybe too complicated) but well explained: :ugeek:
https://www.redblobgames.com/grids/hexagons/

Cheers
x32
Posts: 85
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

12 Apr 2018, 09:42

That is interesting but beyond my level. However I'm going to study it and see if I can make it work in AHK.
User avatar
kczx3
Posts: 692
Joined: 06 Oct 2015, 21:39

Re: Hex Calc

12 Apr 2018, 19:04

I’d think this could done with gdi as well. It’d be super easy with html/js/css
x32
Posts: 85
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

12 Apr 2018, 19:32

kczx3 wrote:I’d think this could done with gdi as well. It’d be super easy with html/js/css
I made this script years ago, using GDIP, where you could load an image for a background, draw the shape of your controls on the image and it would produce transparent windows over the background image which would received the click. In short, you could draw your own buttons on your background.

That was here;
https://autohotkey.com/board/topic/7034 ... e-buttons/
x32
Posts: 85
Joined: 25 Nov 2016, 16:44

Re: Hex Calc

13 Apr 2018, 10:06

And just because I was reminded about an old script...

Cube Calc. Created using my old script Area as Control.ahk. This took a fraction of the time as creating it from scratch.

Uses DockA to keep it all together and Eval for the calculations.

The scripts, libraries and pics can be found in the zip file, Cube Calc

Image
This code was mostly written automatically. The edit box and transparent background were added.

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance , Force
DetectHiddenWindows, On
Gui, Color, aabbcc
WinSet, TransColor, aabbcc, Cube_Calc

Gui, Add, Edit, x90 y0 w150 r1 Right vedit1,
Gui, Add, Pic, x0 y0 w325 h325 vMoveGui gPic1, cube.png
Gui, +LastFound -Caption
Gui, Show, w325 h325, Cube_Calc
GoSub AddControls

OnMessage(0x201, "WM_LBUTTONDOWN")
Return

#Include Cube_Calc_Subroutines.ahk
WM_LBUTTONDOWN()
{
MouseGetPos, , , OverWin,
WinGetTitle, title, ahk_id%OverWin%
StringReplace, title, title, %A_Space%, _, All 
If IsLabel(title)
Gosub, %title%
}
Return
Esc::
Exit:
GuiClose:
Gui, Destroy
ExitApp

Pic1:
WinActivate, Cube_Calc
PostMessage, 0xA1, 2,,, A 
Loop, 
{
KeyIsDown := GetKeyState("LButton")
If KeyIsDown = 1
Sleep, 50
If KeyIsDown = 0
Break
}
Return

AddControls:
WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 11:Color, Black
Gui, 11:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 1
WinSet, Transparent, 1, 1
WinSet, Region, 42-239 41-189 71-205 73-257 46-240 42-239, 1
Gui, 11:+LastFound +Toolwindow -Caption
Gui, 11:Show, , 1
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 1
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 12:Color, Black
Gui, 12:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 2
WinSet, Transparent, 1, 2
WinSet, Region, 74-261 74-208 109-227 110-278 77-257 74-261, 2
Gui, 12:+LastFound +Toolwindow -Caption
Gui, 12:Show, , 2
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 2
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 13:Color, Black
Gui, 13:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 3
WinSet, Transparent, 1, 3
WinSet, Region, 117-282 116-230 156-248 156-248 155-299 117-276 117-276 117-282, 3
Gui, 13:+LastFound +Toolwindow -Caption
Gui, 13:Show, , 3
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 3
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 14:Color, Black
Gui, 14:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 4
WinSet, Transparent, 1, 4
WinSet, Region, 40-183 36-133 70-151 70-198 40-180 40-183, 4
Gui, 14:+LastFound +Toolwindow -Caption
Gui, 14:Show, , 4
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 4
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 16:Color, Black
Gui, 16:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 5
WinSet, Transparent, 1, 5
WinSet, Region, 75-203 73-151 110-167 111-167 110-220 74-200 74-200 75-203, 5
Gui, 16:+LastFound +Toolwindow -Caption
Gui, 16:Show, , 5
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 5
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 17:Color, Black
Gui, 17:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 6
WinSet, Transparent, 1, 6
WinSet, Region, 113-225 114-170 158-191 156-245 156-245 113-222 113-225, 6
Gui, 17:+LastFound +Toolwindow -Caption
Gui, 17:Show, , 6
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 6
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 18:Color, Black
Gui, 18:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 7
WinSet, Transparent, 1, 7
WinSet, Region, 34-126 34-76 34-76 67-91 69-142 38-126 34-126, 7
Gui, 18:+LastFound +Toolwindow -Caption
Gui, 18:Show, , 7
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 7
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 19:Color, Black
Gui, 19:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 8
WinSet, Transparent, 1, 8
WinSet, Region, 72-143 72-92 110-109 110-161 74-144 72-143, 8
Gui, 19:+LastFound +Toolwindow -Caption
Gui, 19:Show, , 8
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 8
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 20:Color, Black
Gui, 20:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 9
WinSet, Transparent, 1, 9
WinSet, Region, 113-166 113-112 113-111 152-128 152-128 154-183 114-164 114-164 113-166, 9
Gui, 20:+LastFound +Toolwindow -Caption
Gui, 20:Show, , 9
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 9
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 21:Color, Black
Gui, 21:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, 0
WinSet, Transparent, 1, 0
WinSet, Region, 158-299 158-250 203-231 204-277 160-297 160-297 158-299, 0
Gui, 21:+LastFound +Toolwindow -Caption
Gui, 21:Show, , 0
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, 0
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 22:Color, Black
Gui, 22:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, plusl
WinSet, Transparent, 1, plusl
WinSet, Region, 158-244 160-194 202-175 205-222 161-243 158-244, plusl
Gui, 22:+LastFound +Toolwindow -Caption
Gui, 22:Show, , plusl
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, plusl
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 23:Color, Black
Gui, 23:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, minus
WinSet, Transparent, 1, minus
WinSet, Region, 157-180 156-131 200-115 201-163 157-180 157-180, minus
Gui, 23:+LastFound +Toolwindow -Caption
Gui, 23:Show, , minus
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, minus
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 24:Color, Black
Gui, 24:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, dot
WinSet, Transparent, 1, dot
WinSet, Region, 211-277 207-229 207-229 250-211 250-211 251-259 213-277 211-277, dot
Gui, 24:+LastFound +Toolwindow -Caption
Gui, 24:Show, , dot
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, dot
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 25:Color, Black
Gui, 25:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, mult
WinSet, Transparent, 1, mult
WinSet, Region, 209-218 210-172 250-154 250-204 250-204 210-217 209-218, mult
Gui, 25:+LastFound +Toolwindow -Caption
Gui, 25:Show, , mult
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, mult
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 26:Color, Black
Gui, 26:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, div
WinSet, Transparent, 1, div
WinSet, Region, 210-158 207-109 207-109 252-94 252-94 250-144 250-144 207-162 207-162 210-158, div
Gui, 26:+LastFound +Toolwindow -Caption
Gui, 26:Show, , div
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, div
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 27:Color, Black
Gui, 27:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, equ
WinSet, Transparent, 1, equ
WinSet, Region, 257-258 256-206 292-195 292-238 256-253 257-258, equ
Gui, 27:+LastFound +Toolwindow -Caption
Gui, 27:Show, , equ
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, equ
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 29:Color, Black
Gui, 29:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, pl
WinSet, Transparent, 1, pl
WinSet, Region, 255-199 257-153 294-136 293-184 256-199 255-199, pl
Gui, 29:+LastFound +Toolwindow -Caption
Gui, 29:Show, , pl
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, pl
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 30:Color, Black
Gui, 30:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, pr
WinSet, Transparent, 1, pr
WinSet, Region, 257-142 256-92 256-92 293-79 297-127 254-140 254-140 257-142, pr
Gui, 30:+LastFound +Toolwindow -Caption
Gui, 30:Show, , pr
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, pr
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 31:Color, Black
Gui, 31:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, xcopy
WinSet, Transparent, 1, xcopy
WinSet, Region, 157-123 117-104 159-89 198-108 157-123 157-123, xcopy
Gui, 31:+LastFound +Toolwindow -Caption
Gui, 31:Show, , xcopy
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, xcopy
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 32:Color, Black
Gui, 32:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, zcut
WinSet, Transparent, 1, zcut
WinSet, Region, 110-102 82-87 82-87 119-74 155-87 113-102 110-102, zcut
Gui, 32:+LastFound +Toolwindow -Caption
Gui, 32:Show, , zcut
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, zcut
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 33:Color, Black
Gui, 33:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, help
WinSet, Transparent, 1, help
WinSet, Region, 70-84 43-69 81-54 114-72 114-72 68-87 70-84, help
Gui, 33:+LastFound +Toolwindow -Caption
Gui, 33:Show, , help
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, help
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 34:Color, Black
Gui, 34:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, xpaste
WinSet, Transparent, 1, xpaste
WinSet, Region, 208-105 171-87 207-73 207-73 245-88 245-88 210-104 208-105, xpaste
Gui, 34:+LastFound +Toolwindow -Caption
Gui, 34:Show, , xpaste
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, xpaste
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 35:Color, Black
Gui, 35:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, selall
WinSet, Transparent, 1, selall
WinSet, Region, 162-86 125-68 125-68 163-58 163-58 203-70 204-70 163-86 163-86 162-86, selall
Gui, 35:+LastFound +Toolwindow -Caption
Gui, 35:Show, , selall
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, selall
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 36:Color, Black
Gui, 36:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, xbs
WinSet, Transparent, 1, xbs
WinSet, Region, 119-67 88-53 126-41 126-41 158-51 120-66 119-67, xbs
Gui, 36:+LastFound +Toolwindow -Caption +E0x08000000 
Gui, 36:Show, NoActivate, xbs
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, xbs
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 37:Color, Black
Gui, 37:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, Exit
WinSet, Transparent, 1, Exit
WinSet, Region, 253-88 215-73 253-57 290-74 290-74 254-84 253-88, Exit
Gui, 37:+LastFound +Toolwindow -Caption
Gui, 37:Show, , Exit
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, Exit
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 38:Color, Black
Gui, 38:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, xdel
WinSet, Transparent, 1, xdel
WinSet, Region, 211-69 173-53 209-40 247-56 209-68 211-69, xdel
Gui, 38:+LastFound +Toolwindow -Caption
Gui, 38:Show, , xdel
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, xdel
DockA(IDG1, IDG, "x(0) y(0) w() h()")

WinGetPos , ShowX, ShowY, ShowW, ShowH, Cube_Calc
Gui, 39:Color, Black
Gui, 39:Show, x%ShowX% y%ShowY% w%ShowW% h%ShowH% Hide, xclr
WinSet, Transparent, 1, xclr
WinSet, Region, 164-54 132-40 165-24 165-24 205-41 205-41 164-50 164-50 164-54, xclr
Gui, 39:+LastFound +Toolwindow -Caption
Gui, 39:Show, , xclr
WinGet, IDG1, ID, Cube_Calc
WinGet, IDG, ID, xclr
DockA(IDG1, IDG, "x(0) y(0) w() h()")

Return
The subroutines were automatically added but empty. The commands had to be added.

Code: Select all

1:
Gui, 1:Submit, NoHide
GuiControl, 1:, edit1, %edit1%1
Return

2:
Gui, 1:Submit, NoHide
GuiControl, 1:, edit1, %edit1%2
Return

3:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%3
Return

4:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%4
Return

5:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%5
Return

6:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%6
Return

7:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%7
Return

8:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%8
Return

9:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%9
Return

0:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%0
Return

plusl:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%+
Return

minus:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%-
Return

dot:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%.
Return

mult:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%*
Return

div:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%/
Return

equ:
Gui, 1:Submit, NoHide 
answer := Eval(edit1)
GuiControl, 1:, edit1, %answer%
Return

pl:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%(
Return

pr:
Gui, 1:Submit, NoHide 
GuiControl, 1:, edit1, %edit1%)
Return

xcopy:
Gui, 1:Submit, NoHide 
ClipBoard = %edit1%
Return

zcut:
Gui, 1:Submit, NoHide 
ClipBoard = %edit1%
GuiControl, 1:, edit1, 
Return

help:
Run, Cube Calc Help.ahk
Return

xpaste:
GuiControl, 1:, edit1, %ClipBoard%
Return

selall:
GuiControl, 1:Focus, edit1,
Send, ^a
Return

xbs:
GuiControl, 1:Focus, edit1,
Send, {BS}
Return

xdel:
GuiControl, 1:Focus, edit1,
Send, {Del}
Return

xclr:
GuiControl, 1:, edit1, 
Return

Return to “Scripts and Functions”

Who is online

Users browsing this forum: robodesign and 46 guests