Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom ini path as command-line parameter #17

Merged
merged 1 commit into from
Nov 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 56 additions & 3 deletions WindowPadX.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,33 @@ Version := "1.2.2"
if 0 > 0
{
; Command-line mode: interpret each arg as a pseudo-command.
; or pass in custom .ini path
; Suspend all hotkeys which may be created by WindowPadXInit.
Suspend On
; Load options and Gather exclusions.
gosub WindowPadXInit

; Execute command line(s). Each args should be in one of these formats:
; <command>
; <command>,<args_no_spaces>
; "<command>, <args>" ; In this case the initial comma is optional.
Loop %0%
wp_ExecLine(%A_Index%)
{
param := %A_Index%
if InStr(param, ".ini")
{
WindowPadX_Init(param)
}
Else
{
gosub WindowPadXInit
wp_ExecLine(param)
}
}
ExitApp
}

OnExit, TrayExit

; Load options and Gather exclusions.
WindowPadXInit:
; If this script is #included in another script, this section may not be
; auto-executed. In that case, the following should be called manually:
Expand All @@ -86,6 +98,8 @@ WindowPadX_Init(IniPath="")
;
; Init icons and tray menu.
;
wp_SetupTray()

if A_IsCompiled ; Load icons from my custom WindowPadX.exe.
{
; Default icon is 32x32, so doesn't look good in the tray.
Expand Down Expand Up @@ -460,6 +474,45 @@ hp_ExecuteHotkeyWithParams:
return
}

;
; Tray Menu
;
;

wp_SetupTray()
{
if A_IsCompiled ; Load icons from my custom WindowPadX.exe.
{
; Default icon is 32x32, so doesn't look good in the tray.
Menu, Tray, Icon, %A_ScriptFullPath%, 2
}
else if (A_LineFile = A_ScriptFullPath)
{ ; Set the tray icon, but only if not included in some other script.
wp_SetTrayIcon(true)
; Use OnMessage to catch "Suspend Hotkeys" or "Pause Script"
; so the "disabled" icon can be used.
OnMessage(0x111, "WM_COMMAND")
}

Menu, Tray, NoStandard
Menu, Tray, MainWindow
Menu, Tray, Add, &Debug, TrayDebug
ifExist, %A_ScriptDir%\WindowPadX.html
{
Menu, Tray, Add, &Help, TrayHelp
Menu, Tray, Add
}
Menu, Tray, Add, &Reload, TrayReload
if !A_IsCompiled
{
Menu, Tray, Add, &Edit Source, TrayEdit
}
Menu, Tray, Add, Edit &Configuration, TrayEditConfig
Menu, Tray, Add
Menu, Tray, Add, &Suspend, TraySuspend
Menu, Tray, Add, E&xit, TrayExit
Menu, Tray, Default, &Debug
}

;
; Tray Icon Override:
Expand Down