; HTML Aid ; Author: Tom Doan ; Date: 6/19/2007 ;=================== ; Directives ;=================== #Hotstring NoMouse #KeyHistory 0 #MaxMem 1 #NoEnv #SingleInstance force ;=================== ; Variables ;=================== AppTitle = HTML Aide AppVersion = 2.6 ;=================== ; Tray menu ;=================== Menu, Tray, NoStandard Menu, Tray, Add, &About... Menu, Tray, Default, &About... Menu, SubInsert, Add, Lin&k`t(Ctrl+K), InsertLink Menu, SubInsert, Add, &List`t(Ctrl+L), InsertList Menu, Tray, Add, &Insert, :SubInsert Menu, Tray, Add Menu, Tray, Add, &Suspend Menu, Tray, Add, E&xit Menu, Tray, Tip, %AppTitle% ;=================== ; Hotkeys ;=================== SendMode InputThenPlay SetTitleMatchMode 2 GroupAdd, HTML, .ht GroupAdd, HTML, Untitled #IfWinActive, ahk_group HTML ~^b:: ClipSaved := ClipboardAll Clipboard = Send ^c ClipWait, 2 If (ErrorLevel = 0) { CleanSpaces() Clipboard = %Clipboard% Send ^v } Clipboard := ClipSaved ClipSaved = Return ~^++:: ClipSaved := ClipboardAll Clipboard = Send ^c ClipWait, 2 If (ErrorLevel = 0) { CleanSpaces() Clipboard = %Clipboard% Send ^v } Clipboard := ClipSaved ClipSaved = Return ^k:: WinGetActiveTitle, WinTitle Gosub, InsertLink Return ^l:: WinGetActiveTitle, WinTitle Gosub, InsertList Return ;=================== ; Hotstrings ;=================== :*?b0: {::{Enter 2}{}}{Up}{Tab} :*b0:{Left 4} :*b0:/*::{Enter 2}*/{Up} :*b0:{Left 7} :*b0:{Left 10} :*b0:
::{Enter 2}
{Up}{Tab} :*b0:::{Left 4} :*b0:::{Left 6} :*b0:
::{Enter 2}
{Up}{Tab} :*b0:::{Enter 2}{Up} :*b0:::{Left 10} :*b0:::{Left 7} :*b0:::{Left 7} :*b0:::{Enter 3}{Up}{Tab}{Up}{Tab}{Left 3} :*b0:
::
{Left 5} :*b0:::{Left 6} :*b0:::{Left 6} :*b0:
::{Enter 2}
{Up}{Tab} :*b0:
::{Enter 2}
{Up}{Tab}
{Enter}
{Up}{Left 5} :*b0:
::
{Left 5} :*b0:::{Left 5} :*b0:
::{Enter 3}
{Up}{Tab}{Up}{Tab}{Left 9} :*b0:
::{Enter 2}
{Up}{Tab} :*b0:{Enter 8}{Up}{Up}{Tab}{Up}{Tab}{Up}{Tab}{Up}{Up}{Tab}<frame src="" name="" marginwidth="0" marginheight="0" scrolling="no" />{Up}{Tab}<frame src="" name="" marginwidth="0" marginheight="0" scrolling="no" />{Left 60} :b0c:`nfunction::() {{}{Enter 2}{}}{Up}{Tab}{Up}{End}{Left 4} :*b0:<h1>::</h1>{Left 5} :*b0:<h2>::</h2>{Left 5} :*b0:<h3>::</h3>{Left 5} :*b0:<h4>::</h4>{Left 5} :*b0:<h5>::</h5>{Left 5} :*b0:<h6>::</h6>{Left 5} :*b0:<html>::{Enter}<head>{Enter}<title></title>{Enter}</head>{Enter}<body>{Enter 2}</body>{Enter}</html>{Up 5}{End}{Left 8} :*b0:<i>::</i>{Left 4} :*b0:<iframe:: src="" frameborder="0" marginwidth="0" marginheight="0" width="" height=""></iframe>{Left 79} :*b0:<img:: src="" alt="" title="" />{Left 20} :*b0:<ins>::</ins>{Left 6} :*b0:<kbd>::</kbd>{Left 6} :*b0:<label>::</label>{Left 8} :*b0:<legend>::</legend>{Left 9} :*b0:<li>::</li>{Left 5} :*b0:<noframes>::{Enter 4}{Up}{Tab}{Up}{Tab}{Up}{Tab}{Down} :*b0:{Up} :*b0:
    ::{Enter 2}
{Up}{Tab} :*b0:::{Enter 2}{Up}{Tab} :*b0:{Left 9} :*b0:

::{Enter 2}

{Up}{Tab} :*b0:
::{Enter 2}
{Up} :*b0:{Left 4} :*b0:::{Left 7} :*b0:{Enter 2}{Up} :*b0:{Up}{Tab} :*b0:::{Left 8} :*b0:::{Left 7} :*b0:::{Left 9} :*b0:{Enter 2}{Up} :*b0:::{Left 6} :*b0:::{Left 6} :*b0:::{Enter 7}
{Up}{Up}{Tab}{Up}{Tab 2}{Up}{Tab 2}{Up}{Tab}{Up}{Down 2}{End}{Left 5} :*b0:::{Enter 2}{Up}{Tab} :*b0:::{Left 5} :*b0:{Left 11} :*b0:::{Enter 2}{Up}{Tab} :*b0:::{Left 5} :*b0:::{Enter 2}{Up}{Tab} :*b0:::{Enter 2}{Up}{Tab} :*b0:::{Left 5} :*b0:
    ::{Enter 2}
{Up}{Tab} :*b0:::{Left 6} ;=================== ; Gosub labels ;=================== &About...: Gui, Destroy Gui, +AlwaysOnTop -SysMenu Gui, Margin, 11, 11 Gui, Add, Picture, Icon1, %A_ScriptName% Gui, Font, bold, Tahoma Gui, Add, Text, x+20 y+-11, %AppTitle% %AppVersion% Gui, Font, norm Gui, Add, Text, vCopyrightText xm y+12, Copyright © 2007%A_Space% Gui, Font, underline Gui, Add, Text, vAuthorText gEmail cBlue x+0, Tom Doan Gui, Font, norm Gui, Add, Text, xm y+0, All rights reserved. GuiControlGet, Text1, Pos, CopyrightText GuiControlGet, Text2, Pos, AuthorText Gui, Add, Button, % "Default w75 y+17 xp+"(Text1W+Text2W)/2-37.5, OK Gui, Show, , %AppTitle% ; Load hand cursor HandCursor := DllCall("LoadCursor", "UInt", NULL, "Int", 32649, "UInt") ; Start monitoring mouse movements OnMessage(0x200, "WM_MOUSEMOVE") Return ButtonCancel: ButtonOK: GuiClose: GuiEscape: Gui, Destroy OnMessage(0x200, "") DllCall("DestroyCursor", "Uint", HandCursor) WinTitle = Return ButtonInsertLink: Gui, Submit LinkURL := RegExReplace(LinkURL, " ") LinkURL := RegExReplace(LinkURL, "^(?!http)", "http://") Target := NewWindow ? " target=""_blank""" : "" Clipboard = %LinkText% Clipboard := RegExReplace(Clipboard, "\s+(<\/a>)", "$1 ") IfWinExist, %WinTitle% { WinActivate Send ^v } Return ButtonInsertList: Gui, Submit ListTag := (ListType = 1) ? "ul" : "ol" ListCode := "<" . ListTag . ">`n" Loop, Parse, ListText, `n, `r { ListCode .= "
  • " . A_LoopField . "
  • `n" } ListCode .= "" Clipboard = %ListCode% IfWinExist, %WinTitle% { WinActivate Send ^v } Return Email: Run, mailto:tom_xyz@yahoo.com?subject=%AppTitle%`%20%AppVersion%`%20feedback, , UseErrorLevel Return E&xit: ExitApp Return InsertLink: If (!WinTitle) { Send !{Tab} WinGetActiveTitle, WinTitle } ClipSaved := ClipboardAll Clipboard = Send ^c ClipWait, 0 CleanSpaces() Gui, Destroy Gui, +AlwaysOnTop +ToolWindow Gui, Font, , Tahoma Gui, Add, Text, , Link text: Gui, Add, Edit, vLinkText w250 x+8 Section, %Clipboard% Gui, Add, Text, xm, Link URL: Gui, Add, Edit, vLinkURL w250 x+0 xs GuiControlGet, Edit, Pos, LinkURL Gui, Add, Checkbox, vNewWindow Checked, &Open in new window Gui, Add, Button, % "gButtonInsertLink Default w75 y+17 xp+"EditW-157, &Insert Gui, Add, Button, w75 x+7, Cancel Gui, Show, , Insert Link Clipboard := ClipSaved ClipSaved = Return InsertList: If (!WinTitle) { Send !{Tab} WinGetActiveTitle, WinTitle } ClipSaved := ClipboardAll Clipboard = Send ^c ClipWait, 0 If (Clipboard) CleanSpaces() Else Clipboard = Enter each list item on its own line Gui, Destroy Gui, +AlwaysOnTop +ToolWindow Gui, Font, , Tahoma Gui, Add, Radio, vListType Checked, &Bulleted Gui, Add, Radio, x+20, &Numbered Gui, Add, Edit, vListText -Wrap r10 w250 xm, %Clipboard% GuiControlGet, Edit, Pos, ListText Gui, Add, Button, % "gButtonInsertList Default w75 y+17 xp+"EditW-157, &Insert Gui, Add, Button, w75 x+7, Cancel Gui, Show, , Insert List If (Clipboard = "Enter each list item on its own line") SendInput {Tab} Else SendInput {Tab 2} WinWaitClose, Insert List Clipboard := ClipSaved ClipSaved = Return &Suspend: Suspend Menu, Tray, ToggleCheck, &Suspend If (A_IconTip = AppTitle) Menu, Tray, Tip, %AppTitle% (Suspended) Else Menu, Tray, Tip, %AppTitle% Return ;=================== ; Functions ;=================== CleanSpaces() { Clipboard := RegExReplace(Clipboard, "^\s*|\s*$") Clipboard := RegExReplace(Clipboard, "[ \t]*([\r\n])[ \t]*", "$1") Clipboard := RegExReplace(Clipboard, "m)^""[ \t]+") } WM_MOUSEMOVE(wParam, lParam) { Global HandCursor MouseGetPos, , , , HoveredCtrl If HoveredCtrl in Static4 DllCall("SetCursor", "UInt", HandCursor) Return }