「河许人」Autohotkey

我的AutoHotKey

2014-09-17  本文已影响445人  鹿角海棠

在日常的工作中有很多东西其实是在重复性操作。
懒人就想出了许多懒办法来提高效率。除了学习自己编程之外,其他有些东西还是相对简单一些,例如VBA和AutoHotKey等。
这里谈谈我的AutoHotKey脚本。
初步看了下手册,目前的水平仅仅写一些最简单的脚本。如果是稍微高级一些的脚本需要对照类似功能的例子来修改。难点在于类似例子不是很好找,需要时间慢慢加深了解,自己来编写自己需要的脚本。


 ; Organic Chemistry Reference Resolver lookup (Win-c)
 ;
 #c::
 ;Copy Clipboard to prevClipboard variable, clear Clipboard.
   prevClipboard := ClipboardAll
   Clipboard =
 ;Copy current selection, continue if no errors.
   SendInput, ^c
   ClipWait, 2
   if !(ErrorLevel) {
 ;Convert Clipboard to text, auto-trim leading and trailing spaces and tabs.
     Clipboard = %Clipboard%
 ;Clean Clipboard: change carriage returns to spaces, change >=1 consecutive spaces to +
     Clipboard := RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "+")
 ;Search http://chemsearch.kovsky.net/
     Run http://chemsearch.kovsky.net/index.php?q=%Clipboard%
 }
 ;Restore Clipboard, clear prevClipboard variable.
   Clipboard := prevClipboard
   prevClipboard =
 return

;
; Search Google with clipboard (Win-g)
;
#g::
 ;Copy Clipboard to prevClipboard variable, clear Clipboard.
   prevClipboard := ClipboardAll
   Clipboard =
 ;Copy current selection, continue if no errors.
   SendInput, ^c
   ClipWait, 2
   if !(ErrorLevel) {
 ;Convert Clipboard to text, auto-trim leading and trailing spaces and tabs.
     Clipboard = %Clipboard%
 ;Clean Clipboard: change carriage returns to spaces, change >=1 consecutive spaces to +
     Clipboard := RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "+")
 ;Search https://www.google.com/
     Run https://www.google.com/search?q=%clipboard%
 }
 ;Restore Clipboard, clear prevClipboard variable.
   Clipboard := prevClipboard
   prevClipboard =
return

;
; Search Google Scholar with clipboard (Win-s)
;
#s::
 ;Copy Clipboard to prevClipboard variable, clear Clipboard.
   prevClipboard := ClipboardAll
   Clipboard =
 ;Copy current selection, continue if no errors.
   SendInput, ^c
   ClipWait, 2
   if !(ErrorLevel) {
 ;Convert Clipboard to text, auto-trim leading and trailing spaces and tabs.
     Clipboard = %Clipboard%
 ;Clean Clipboard: change carriage returns to spaces, change >=1 consecutive spaces to +
     Clipboard := RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "+")
 ;Search http://scholar.google.com/
     Run http://scholar.google.com/scholar?hl=en&q=%Clipboard%
 }
 ;Restore Clipboard, clear prevClipboard variable.
   Clipboard := prevClipboard
   prevClipboard =
return

;
; Convert Selection to Lower Case. (Win-2)
;
#2:: 
bak = %clipboard% 
Send, ^c 
StringLower, clipboard, clipboard 
Send, ^v 
clipboard = %bak% 
return 

;
; Check the reference in my Endnote (F3)
;
; This script was created using Pulover's Macro Creator
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
DetectHiddenWindows On
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
F3::
 ;Copy Clipboard to prevClipboard variable, clear Clipboard.
   prevClipboard := ClipboardAll
   Clipboard =
 ;Copy current selection, continue if no errors.
   SendInput, ^c
   ClipWait, 2
Macro1:
WinActivate, EndNote X7 - [XXX.enl] ahk_class EndNote X7 Frame
Sleep, 2
Click, 82, 122 Left, Down
Sleep, 2
Click, 82, 122 Left, Up
Sleep, 2
Click, 761, 66 Left, Down
Sleep, 2
Click, 761, 66 Left, Up
Sleep, 2
Send, {LControl Down}
Sleep, 2
Send, {v Down}
Sleep, 2
Send, {LControl Up}{v Up}
Sleep, 2
Send, {Enter Down}
Sleep, 2
Send, {Enter Up}
Return
上一篇 下一篇

猜你喜欢

热点阅读