Please read the comments in the code. They explain everything.
Code:
/*
Another nerdy experiment by me.
So the story behind this script is this:
After closing my locker at school one day, I realized how plain and boring it was. So I thought I might spice it up a bit. Being the dork that I am, I thought it would be
awesome to have a magnetic array of LEDs, 7 LEDs tall by 42 LEDs wide, that would be programmable via a palm pilot or similar device. I chose 7x42 because every letter of the
alphabet can be made 7 LEDs tall and 5 LEDs wide (I think). So 7x42 would give me just enough room to spell short words, and possibly some small pictures. But what if I wanted
longer words? BINGO! I could have it scroll horizontally. I immediately started coming up with lots of ideas, such as the ability to scroll up, down, left, and right, blinking,
and all sorts of stuff. So when I got home that day I started writing this script as a sort of demo. Now I'm asking for your input, ideas, and/or contributions. Eventually, this
software will become hardware.
P.S. - I'm a sophomore in high school and I'm quite the noob. Please don't point and laugh.
Thanks =]
*/
IfNotExist, %A_ScriptDir%\Saved
{
FileCreateDir, %A_ScriptDir%\Saved
}
Y11 = 10
Y2 = -1
Number = -1
Loop, 7{
x11 = 12
X2 = -1
Y11 += 11
Y2 += 1
Loop, 42{
X11 += 11
X2 += 1
Number += 1
/*
Gui, Add, Button, X%X11% Y0 W12 H16 vClrColumn%Number% gClrColumn, C ;These were supposed to clear the entire column below them, but they don't work
Gui, Add, Button, X0 Y%Y11% W16 H12 vClrRow%Number% gClrRow, C ;These were supposed to clear the entire row next to them, but they don't work
*/
Gui, Add, Checkbox, X%X11% Y%Y11% W12 H12 -Wrap Check3 vChkBx%X2%%Y2% gFill
}
}
;Gui, Add, Button, X0 vLEDScroll gLEDScroll, LED Scroll ;Doesn't work
Gui, Add, Button, X0 vInvert gInvert, Invert
Gui, Add, Button, X0 vClrAll gClrAll, Clear All
/*
Gui, Add, Button, X0 vSave gSaveAs, Save As ;This sort of works. Not really.
Gui, Add, Button, X0 vLoadFile gLoadFile, Load File ;I was going to have a GUI pop up with a list of files in the "Saved" folder.
Gui, Add, Button, X0 vLoadManualy gLoadManualy, Load Manualy ;I was goint to have a GUI pop up with relatively large text field where you could paste text.
*/
Gui, Show, Center AutoSize, LED Scroller
Fill:
MouseGetPos,,,,ChkBxNum
GuiControlGet, ChkBxStatus,, %ChkBxNum%
If ChkBxStatus=-1
GuiControl,, %ChkBxNum%, 0
Else If ChkBxStatus=1
GuiControl,, %ChkBxNum%, -1
Gui, Show, AutoSize, LED Scroller
Return
ClrAll:
Y3 = -1
Loop, 7{
X3 = -1
Y3 += 1
Loop, 42{
X3 += 1
Number += 1
GuiControl,, ChkBx%X3%%Y3%, 0
}
}
Return
/*
ClrColumn:
ColumnControl = A_GuiControl
StringReplace, X4, ColumnControl, ClrColumn
Y4 = -1
Loop, 7{
Y4 ++
GuiControl,, ChkBx%X4%%Y4%
}
Return
*/
/*
ClrRow:
RowControl = A_GuiControl
StringReplace, Y5, RowControl, ClrRow
X5 = -1
Loop, 7{
X5 ++
GuiControl,, ChkBx%X5%%Y5%
}
Return
*/
Invert:
Y3 = -1
Loop, 7{
X3 = -1
Y3 += 1
Loop, 42{
X3 += 1
GuiControlGet, ChkBxStatus,, ChkBx%X3%%Y3%
If ChkBxStatus=-1
GuiControl,, ChkBx%X3%%Y3%, 0
Else If ChkBxStatus=0
GuiControl,, ChkBx%X3%%Y3%, -1
}
}
Gui, Show, AutoSize, LED Scroller
Return
/*
SaveAs:
Gui, 2:Add, Text,, Save As:
Gui, 2:Add, Edit, vSaveAs
Gui, 2:Add, Button, vSave gSave, Save
Gui, 2:Show, Center AutoSize, Save As
Return
*/
/*
Save:
Gui, Submit
Y6 = -1
Loop, 7{
X6 = -1
Y6 += 1
Loop, 42{
X6 += 1
Number += 1
If ChkBx%X6%%Y6% = -1
FileAppend, %X6%%Y6%`n, %A_ScriptDir%\Saved\%SaveAs%.txt
Else If ChkBx%X6%%Y6% = 0
Continue
}
}
Return
*/
/*
LoadFile:
Return
*/
/*
LoadManualy:
Return
*/
/*
LEDScroll: ;Obviously this could use some cleaning up. I probably could've used functions, but hey, I'm a noob.
Number = 0
Y7 = -1
Loop, 7{
X7 = -1
Y7 += 1
Loop, 42{
X7 += 1
If ChkBx%X7%%Y7% = -1
{
Number ++
Bit%Number% = %X7%%Y7%
Bit%Number%X = %X7%
Bit%Number%Y = %Y7%
}
Else If ChkBx%X7%%Y7% = 0
Continue
}
}
BitCount = %Number%
BitNum = 0
Loop{
Loop, %BitCount%{
BitNum ++
Bit%BitNum%X --
If Bit%BitNum%X < 0
Bit%BitNum%X = 42
}
Y8 = -1
Loop, 7{
X8 = -1
Y8 += 1
Loop, 42{
X8 += 1
GuiControl,, ChkBx%X8%%Y8%, 0
}
}
Number = 0
Loop, %BitCount%{
Number ++
ChkBxBitX = Bit%Number%X
ChkBxBitY = Bit%Number%Y
ChkBx%ChkBxBitX%%ChkBxBitY% = -1
}
Gui, Show, AutoSize, LED Scroller
}
Return
*/
GuiClose:ExitApp