
; coding: utf-8 with BOM ; A funciton to convert any word to HTML/XML tag ; usage: ; 1. assign the function to any hot key. ; 2. put the caret like [space]IFRAME[caret]. ; 3. execute hot key. ; 4. you will have <IFMARE>[caret]</IFRAME>. ; If a word matches the variable "regNoMove", ; the caret doesn't move to inside of tag. ; for tesing: ; a b i p s ; h1 h2 s1 s2 ; ul ol li ; div pre xmp code ; table tr th td ; iframe ; script ; crimson CreateTags() { local regNoMove := "^s1$" ; example local bak := ClipboardAll Send,{Shift}+{Home}^c ClipWait local len0 := StrLen(Clipboard) Send,{Right %len0%} RegExMatch(Clipboard, " ([a-zA-Z]\w*)$", $) local len1 := StrLen($1) + 1 if (len1 > 1) { Clipboard = % "<" . $1 . "></" . $1 . ">" ClipWait Send,{Shift}+{Left %len1%}^v if (! RegExMatch($1, regNoMove)) { local len2 := % len1 + 2 Send,{Left %len2%} } } Clipboard = % bak Return } sc079 & h::CreateTags() ; assign it to your hot key.
使用風景を動画にしました。実行環境は
最初は、よく入力するタグを登録して別々にホットキーを設定し始めたものの、タグが多いし英大文字・小文字の対応とか
動画を見れば分かりますが、タグが行の先頭から遠いほど動作が遅いです。いったん先頭まで選択
AutoHotkey