diff --git a/ad-abstract.png b/ad-abstract.png new file mode 100644 index 0000000..52d0e97 Binary files /dev/null and b/ad-abstract.png differ diff --git a/ad-bug.png b/ad-bug.png new file mode 100644 index 0000000..dbb552d Binary files /dev/null and b/ad-bug.png differ diff --git a/ad-danger.png b/ad-danger.png new file mode 100644 index 0000000..6ec4c9d Binary files /dev/null and b/ad-danger.png differ diff --git a/ad-example.png b/ad-example.png new file mode 100644 index 0000000..c4f0220 Binary files /dev/null and b/ad-example.png differ diff --git a/ad-failure.png b/ad-failure.png new file mode 100644 index 0000000..8674fbe Binary files /dev/null and b/ad-failure.png differ diff --git a/ad-info.png b/ad-info.png new file mode 100644 index 0000000..4d2d9be Binary files /dev/null and b/ad-info.png differ diff --git a/ad-note.png b/ad-note.png new file mode 100644 index 0000000..632ce0b Binary files /dev/null and b/ad-note.png differ diff --git a/ad-question.png b/ad-question.png new file mode 100644 index 0000000..26347ec Binary files /dev/null and b/ad-question.png differ diff --git a/ad-quote.png b/ad-quote.png new file mode 100644 index 0000000..a649608 Binary files /dev/null and b/ad-quote.png differ diff --git a/ad-success.png b/ad-success.png new file mode 100644 index 0000000..70ecca7 Binary files /dev/null and b/ad-success.png differ diff --git a/ad-tip.png b/ad-tip.png new file mode 100644 index 0000000..807c709 Binary files /dev/null and b/ad-tip.png differ diff --git a/ad-warning.png b/ad-warning.png new file mode 100644 index 0000000..4876c3a Binary files /dev/null and b/ad-warning.png differ diff --git a/admonitions-gui.ahk b/admonitions-gui.ahk new file mode 100644 index 0000000..d5c919a --- /dev/null +++ b/admonitions-gui.ahk @@ -0,0 +1,37 @@ +; Generated by AutoGUI 2.6.2 +#SingleInstance Force +#NoEnv +SetWorkingDir %A_ScriptDir% +SetBatchLines -1 + +Gui Font, s12, Segoe UI +Gui Add, Text, x16 y24 w70 h23 +0x200, 類型: +Gui Add, Picture, x240 y0 w176 h81, Z:\pic\ad-abstract.png +Gui Add, Picture, x416 y0 w149 h82, Z:\pic\ad-info.png +Gui Add, Picture, x88 y88 w150 h78, Z:\pic\ad-tip.png +Gui Add, Picture, x240 y88 w174 h77, Z:\pic\ad-success.png +Gui Add, Picture, x419 y86 w151 h75, Z:\pic\ad-question.png +Gui Add, Picture, x240 y168 w172 h75, Z:\pic\ad-failure.png +Gui Add, Picture, x421 y169 w144 h73, Z:\pic\ad-danger.png +Gui Add, Picture, x88 y248 w143 h76, Z:\pic\ad-bug.png +Gui Add, Picture, x240 y248 w175 h76, Z:\pic\ad-example.png +Gui Add, Picture, x419 y248 w147 h74, Z:\pic\ad-quote.png +Gui Add, Picture, x88 y168 w150 h76, Z:\pic\ad-warning.png +Gui Add, Picture, x87 y6 w151 h76, Z:\pic\ad-note.png + +Gui Show, x474 y140 w594 h348, Admonition 提醒區塊 + +OnMessage(0x201, "OnWM_LBUTTONDOWN") +Return + +AdNote(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + +} + +GuiEscape: +GuiClose: + ExitApp + +OnWM_LBUTTONDOWN(wParam, lParam, msg, hWnd) { + +} diff --git a/admonitions.ahk b/admonitions.ahk new file mode 100644 index 0000000..fd35e9d --- /dev/null +++ b/admonitions.ahk @@ -0,0 +1,112 @@ +; Generated by AutoGUI 2.6.2 +; Author: Jerry http://jdev.tw/blog +; AutoHotkey GUI for Obsidian-Admonitions plugin +; Version: v0.0.1 +#SingleInstance Force +#NoEnv +SetWorkingDir %A_ScriptDir% +SetBatchLines -1 + +global k_ID := 0 + + +!q:: +WinGet, k_ID, ID, A +Gui Font, s12, Segoe UI +Gui Add, Text, x16 y24 w70 h23 +0x200, 類型: +Gui Add, Picture, gAdNote x88 y4 w151 h76, %A_ScriptDir%\ad-note.png +Gui Add, Picture, gAdAbstract x240 y0 w176 h81, %A_ScriptDir%\ad-abstract.png +Gui Add, Picture, gAdInfo x416 y0 w149 h82, %A_ScriptDir%\ad-info.png +Gui Add, Picture, gAdTip x88 y88 w150 h78, %A_ScriptDir%\ad-tip.png +Gui Add, Picture, gAdSuccess x240 y88 w174 h77, %A_ScriptDir%\ad-success.png +Gui Add, Picture, gAdQuestion x419 y86 w151 h75, %A_ScriptDir%\ad-question.png +Gui Add, Picture, gAdFailure x240 y168 w172 h75, %A_ScriptDir%\ad-failure.png +Gui Add, Picture, gAdDanger x421 y169 w144 h73, %A_ScriptDir%\ad-danger.png +Gui Add, Picture, gAdBug x88 y248 w143 h76, %A_ScriptDir%\ad-bug.png +Gui Add, Picture, gAdExample x240 y248 w175 h76, %A_ScriptDir%\ad-example.png +Gui Add, Picture, gAdQuote x419 y248 w147 h74, %A_ScriptDir%\ad-quote.png +Gui Add, Picture, gAdWarning x88 y168 w150 h76, %A_ScriptDir%\ad-warning.png + +Gui Show, x782 y143 w594 h341, Admonition 提醒區塊 + +Return + +GuiEscape: +GuiClose: + Gui Cancel + +admonition(type, title) { + Clipboard = +( +``````ad-%type% +title: %title% +collapse: open +content: +```````n +) + len := StrLen(title) + ClipWait + WinActivate, ahk_id %k_ID% + SendInput, ^v + SendInput, {up 4}{end}{left %len%} +} + +AdNote(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("note", "備註") + Gui Cancel +} + +AdAbstract(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("abstract", "摘要") + Gui Cancel +} + +AdInfo(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("info", "資訊") + Gui Cancel +} + +AdTip(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("tip", "小技巧") + Gui Cancel +} + +AdSuccess(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("success", "完成") + Gui Cancel +} + +AdQuestion(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("question", "問題") + Gui Cancel +} + +AdFailure(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("failure", "失敗") + Gui Cancel +} + +AdDanger(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("danger", "錯誤") + Gui Cancel +} + +AdBug(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("bug", "臭蟲") + Gui Cancel +} + +AdExample(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("example", "範例") + Gui Cancel +} + +AdWarning(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("warning", "警告") + Gui Cancel +} + +AdQuote(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { + admonition("quote", "引用") + Gui Cancel +}