This code doesn't exactly do anything different than before but it looks nicer and flows a little more clearly, my being an artist means that I am all about the aesthetics of everything I do and so I spent all morning making the code better looking and functioning
Code:
; <COMPILER: v1.0.48.3>
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#NoTrayIcon
Start2:
Gui, Add, ListView , Grid 0x800000 -Hdr r15 w90 gMyListView, programs
Gui, Add, Button,, %A_Space%%A_Space%Edit%A_Space%%A_Space%
Gui, -SysMenu
Gui, +ToolWindow
Open = 0
Loop, %A_MyDocuments%\Launcher\*.lnk
{
StringTrimRight, Loop, A_LoopFileName, 4
LV_Add( "", Loop )
LV_ModifyCol(-1)
}
IfEqual, a, 1
{
Goto, Show
}
return
~LButton::
Gui, Submit, NoHide
SetTitleMatchMode, 2
SetTitleMatchMode, Slow
IfWinNotActive, Launcher
{
IfLess,Open, 1
{
Gui, destroy
Goto, Start2
}
}
Return
~MButton::
MouseGetPos, mX, mY
Show:
IfEqual, c, 1
{
Open = 1
}
a = 0
c = 0
SoundPlay, click.wav
AutoTrim, off
lau = Launcher
Loop, 9
{
lau = %A_Space%%lau%
}
Gui, Show, X%mX% Y%mY%, %lau%
Return
~RButton::
Gui, Submit, NoHide
SetTitleMatchMode, 2
SetTitleMatchMode, Slow
IfWinNotActive, Launcher
{
IfLess,Open, 1
{
Gui, destroy
Goto, Start2
}
}
Return
MyListView:
if A_GuiEvent = DoubleClick
{
i = %A_EventInfo%
IfGreater, i, 0
{
LV_GetText(RowText, i)
SetTitleMatchMode, 2
IfWinExist, %RowText%
{
IfEqual, Open, 1
{
a = 1
}
Else,
{
C = 0
a = 0
}
SoundPlay, click.wav
WinActivate, %RowText%
Gui, Destroy
Goto, Start2
}
IfWinNotExist, %RowText%
{
SoundPlay, click.wav
Run, %A_MyDocuments%\Launcher\%RowText%
IfEqual, Open, 1
a = 1
Gui, Destroy
Goto, Start2
}
IfEqual, Open, 1
c = 1
a = 1
Gui, Destroy
Goto, Start2
}
}
Return
ButtonEdit:
SoundPlay, click.wav
Run, %A_MyDocuments%\Launcher
SetTitleMatchMode, 2
WinWait, %A_MyDocuments%\Launcher
WinGet, we, ID, %A_MyDocuments%\Launcher
While, we
{
Open = 1
WinGet, we, ID, %A_MyDocuments%\Launcher
}
Open = 0
a = 1
Gui, Destroy
GoTo, Start2
Return