I just did a little revamping of this and figured I'd put it in again.
In this one:
Hovering over the tray icon will show the hotkeys used. If you decide to change those hotkeys in the script, make sure you change the "TrayTip" and "Menu, Tray, Tip," {both at the top}.
Also, I've put in a little GUI to add an icon {I keep the ones I regularly use for scripts in an AHK folder}.
The ini holds the Compiler Directory, Icon Directory and Icon Used until they are changed. The script being done is only held until you close AHKOpener.
If you use this on different computers {via flash drive, as I do} the root directory for the compiler & icon directories will change automatically to the letter of your flash drive.
I got the Splash image going for 10 seconds {sleep, 10000} just so I don't try to run it before it's finished compiling. You can change/delete the sleep to suit yourself {like you need MY permission to do that, lol}.
I think that's about it, so I'll just post the script/ini now.
Code:
/*
A simple little tool to run whichever AHK-made program I'm working on.
WindowsKey + "a" will compile the script.
WindowsKey + "i" to select the icon.
WindowsKey + "r" will Run the EXE file.
I made this specifically for checking my AHK-made programs instead of
constantly saving, compiling, then going to the file and double-clicking it.
Working Name: AHKOpener.ahk
Created By: Matthew "Dra'Gon" Stohler
Begun: 18Jun08
Completed: 22Oct08 {more or less just "adjusting" it}
Email: mattstohler@yahoo.com
ScreenName: Dra_Gon
Use it however you wish and enjoy!
-> With thanks to "IconBoy" for asking the question
which gave me this idea.
-------------------------------------
*/
#SingleInstance ignore
#Persistent
SetTitleMatchMode, 2
Menu, Tray, NoStandard
Menu, Tray, Add, Exit, ByeBye
Menu, Tray, Default, Exit
Menu, Tray, Tip, Win+A = Compile Script`nWin+I = Change Icon`nWin+R = Run EXE'd Script, 5, 17
TrayTip, HotKeys:, Win+A = Compile Script`nWin+I = Change Icon`nWin+R = Run EXE'd Script, 5, 17
IFile := A_ScriptDir "\AHKFile.ini"
IniRead, cmpDir, %IFile%, Filer, CompDir
IniRead, icnDir, %IFile%, Filer, IconDir
IniRead, useIcon, %IFile%, Filer, IconUsed
SplitPath, A_ScriptDir,,,,, tmpDrvS
SplitPath, cmpDir,,,,, tmpDrvC
If tmpDrvS <> %tmpDrvC%
{
StringReplace, cmpDir, cmpDir, %tmpDrvC%, %tmpDrvS%
StringReplace, icnDir, icnDir, %tmpDrvC%, %tmpDrvS%
IniWrite, %cmpDir%, %IFile%, Filer, CompDir
IniWrite, %icnDir%, %IFile%, Filer, CompIcons
}
#a::Gosub AHKCompile
#i::Gosub GetIcon
#r::
IniRead, opnFile, %IFile%, Filer, ToOpen
IfInString, opnFile, .exe
{
IfExist, %opnFile%
Run, %opnFile%
Else
StopMsg("That file don't exist nohow!")
}
Else
StopMsg("You ain't got no EXE file there!")
return
ByeBye:
noData =
IniWrite, %noData%, %IFile%, Filer, ToOpen
ExitApp
Return
AHKCompile:
IfNotExist, %cmpDir%\ahk2exe.exe
{
FileSelectFolder, cmpDir, *%A_WorkingDir%, 3, Compiler Directory?
IniWrite, %cmpDir%, %IFile%, Filer, CompDir
}
IfNotExist, %icnDir%
{
FileSelectFolder, icnDir, *%A_WorkingDir%, 3, Icon Directory?
IniWrite, %icnDir%, %IFile%, Filer, CompIcons
}
IfWinActive, PSPad
{
WinGetActiveTitle, ahk2Compile
StringReplace, ahk2Compile, ahk2Compile, PSPad - [
StringReplace, ahk2Compile, ahk2Compile, ]
StringReplace, ahk2Compile, ahk2Compile, `*
StringReplace, Runner, ahk2Compile, .ahk, .exe
SplitPath, ahk2Compile, ahkFile
SplashImage,, B2, Compiling:`n%ahkFile%,,, Copperplate Gothic Light
SendEvent {Ctrl Down}{s}{Ctrl Up}
Run, %cmpDir%\Ahk2Exe.exe /in "%ahk2Compile%" /icon "%icnDir%\%useIcon%"
IniWrite, "%Runner%", %IFile%, Filer, ToOpen
Sleep, 10000
SplashImage, Off
}
Else
StopMsg("You ain't got PSPad up 'n front, Neighbor!")
Return
GetIcon:
Gui, Add, Text, x5 y5, Double-Click Icon for Compiling script:
Gui, Add, ListView, x5 y+10 IconSmall vlvwIcons gUseIcon
Gui, Show, Center AutoSize, Get Icon(Current-%useIcon%)
Loop, %icnDir%\*.ico
LV_Add("",A_LoopFileName)
Return
GuiClose:
Gui, Destroy
Return
UseIcon:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo)
useIcon := RowText
IniWrite, %RowText%, %IFile%, Filer, IconUsed
Gui, Destroy
}
Return
StopMsg(nowMsg)
{
MsgBox, 48, Whoa!, %nowMSG%`nTry again, programmer!
}
Code:
[Filer]
CompDir=D:\123\Program Files\AutoHotKey\Compiler
IconDir=D:\123\Program Files\AutoHotKey\Scripts\Icons
IconUsed=star.ico
ToOpen=
Enjoy!
Ciao,
Dra'Gon