我的 AutoHotKey 脚本

N 早之前的文章(http://blog.csdn.net/shell_picker/archive/2010/02/24/5321551.aspx)大概提到了 AutoHotKey 这款键盘宏工具,实现的功能大概就是把 p 扩展成 <p></p> 之类的。这篇文章就来晒晒我的 AutoHotKey 脚本是怎么写的吧。

 

现在这个 AutoHotKey 脚本是我开机第一个就启动的程序。我觉得 AutoHotKey 应该是开发者的必备工具,你由此可以了解 AutoHotKey 是个多么 imba 的东西。

 

; 第一个快捷键:Win + h,功能把一段文本中的 < > & 等字符替换成 HTML 实体,便于直接粘贴到 HTML 中。 #h:: Send ^x strTmp = %Clipboard% StringReplace, strTmp, strTmp, &, &`;, all StringReplace, strTmp, strTmp, <, <`;, all StringReplace, strTmp, strTmp, >, >`;, all StringReplace, strTmp, strTmp, %A_Space%%A_Space%,  `;%A_Space%, all StringReplace, strTmp, strTmp, %A_Space%%A_Space%, %A_Space% `;, all Clipboard = %strTmp% Send ^v return #Hotstring EndChars `t ; 定义 Hotstring 的触发键:tab。下面就是一大堆 Hotstring ,下面不解释。// 有了 AutoHotKey 再加上 Vim 的 AutoComplPop 插件,TextMate 神马的都是浮云。 ; For HTML :O:p::<p></p>{Left 4} :O:div::<div></div>{Left 6} :O:a::<a href=""></a>{Left 6} :O:img::<img alt="" src="" />{Left 4} :O:h1::<h1></h1>{Left 5} :O:h2::<h2></h2>{Left 5} :O:h3::<h3></h3>{Left 5} :O:h4::<h4></h4>{Left 5} :O:h5::<h5></h5>{Left 5} :O:h6::<h6></h6>{Left 5} :O:br::<br /> :O:ol::<ol></ol>{Left 5} :O:ul::<ul></ul>{Left 5} :O:li::<li></li>{Left 5} :O:dl::<dl></dl>{Left 5} :O:dt::<dt></dt>{Left 5} :O:dd::<dd></dd>{Left 5} :O:code::<code></code>{Left 7} :O:span::<span></span>{Left 7} :O:pre::<pre></pre>{Left 6} :O:b::<b></b>{Left 4} :O:strong::<strong></strong>{Left 9} :O:q::<q></q>{Left 4} :O:cite::<cite></cite>{Left 7} :O:td::<td></td>{Left 5} :O:tr::<tr></tr>{Left 5} :O:th::<th></th>{Left 5} :O:del::<del></del>{Left 6} :O:ins::<ins></ins>{Left 6} :O:table::<table></table>{Left 8} :O:tbody::<tbody></tbody>{Left 8} :O:caption::<caption></caption>{Left 10} :O:style::<mce:style type="text/css"><!-- --></mce:style><style type="text/css" mce_bogus="1"></style>{Left 8}{Enter}{Up}{End}{Enter} :O:option::<option></option>{Left 9} :O:input::<input type="" name="" />{Left 12} ; For Java :O:/::/* */{Left 3} :O:if:: { SendInput if (){Enter}{{} Sleep 30 SendInput {Enter}{}}{Up 2}{End}{Left} } return :O:else:: { SendInput else{Enter}{{} Sleep 30 SendInput {Enter}{}}{Up}{End}{Enter} } return :O:while:: { SendInput while (){Enter}{{} Sleep 30 SendInput {Enter}{}}{Up 2}{End}{Left} } return :O:for:: { InputBox i, input, Which iterator? SendInput for (%i% = 0`; %i% < `; +=+=%i%){Enter}{{} Sleep 30 SendInput {Enter}{}}{Up 2}{End}{Left 6} } return :O:try:: { SendInput try Sleep 30 SendInput {Enter}{{} Sleep 30 SendInput {Enter}{}} Sleep 30 SendInput {Enter}catch(Exception e) Sleep 30 SendInput {Enter}{{} Sleep 30 SendInput {Enter}{}} Sleep 30 SendInput {Enter}finally Sleep 30 SendInput {Enter}{{} Sleep 30 SendInput {Enter}{}}{Up 7} Sleep 30 SendInput {Enter} } return ; For C/C++ :O:main:: { SendInput int main(int argc, char *argv[]){Enter}{{}{Enter}{}}{Up}{End} Sleep 100 SendInput {Enter}return 0`;{Up}{End} Sleep 30 SendInput {Enter} } return ; For XML :O:xml::<?xml version="1.0" encoding="utf-8"?> :O:x/::<+1-- -->{Left 4} :O:cd::<+1[CDATA[]]>{Left 3} ; For ant :O:target:: { SendInput <target name="" depends="" description=""></target>{Left 9} Sleep 300 SendInput {Enter}{Up}{End}{Enter} } return

你可能感兴趣的:(html,exception,脚本,input,UP,textmate)