moonhuahua 最近的时间轴更新
moonhuahua

moonhuahua

V2EX 第 139647 号会员,加入于 2015-09-24 11:40:16 +08:00
moonhuahua 最近回复了
里面赠送了个快速切换微信联系人的彩蛋,哈哈
global space_up

;{ 新 space 脚本
Space Up::
global space_up := true
Send, {F18}
sendinput {Space Up}
return
Space::
if AnyKeyPressedOtherThanSpace(){
SendInput, {Blind}{Space}
Return
}
space_up := False
inputed := False
wordformatcopy := 0
input, UserInput, L1 T0.05, {F18}
if (space_up){
Send, {Blind}{Space}
return
}else if (StrLen(UserInput) == 1){
Send, {Space}%UserInput%
return
}
while true{
input, UserInput, L1, {LControl}{RControl}{LAlt}{RAlt}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause}{Tab}{F18}{F23}{RButton}
;~ MsgBox %ErrorLevel%
if (space_up){
if (!inputed){
Send, {Blind}{Space}
}
break
return
}else if (UserInput == "``"){
return
}else if (ErrorLevel="EndKey:Tab"){
SendKey("{Down}")
;~ return
}else if (ErrorLevel="EndKey:LWin"){
Send, {Space}
;~ return
}else if (ErrorLevel="EndKey:RWin"){
SendKey("{Left}")
}else if (ErrorLevel="EndKey:F1"){
SendKey("{Left}", 8)
return
}else if (ErrorLevel="EndKey:F2"){
return
}else if (ErrorLevel="EndKey:F3"){
sendinput !p
return
}else if (ErrorLevel="EndKey:F4"){
wingettitle, ut, A
if ut = Adobe Photoshop CC 2015
Send, !{F4}
else
{
SendInput ^w
Sleep 100
SendInput n{Enter}
}
return
}else if (StrLen(UserInput) == 1) {
inputed := True ;;;;;;;;;;;;;;;正式开始;;;;;;;;;;;;;;;
if (UserInput == "w")
Send, {up}
;~ return
else if (UserInput == "s")
Send, {Down}
;~ return
else if (UserInput == "a")
Send, {Left}
else if (UserInput == "d")
Send, {Right}
else if (UserInput == "W")
Send, !]
;~ return
else if (UserInput == "S")
return
else if (UserInput == "A")
return
else if (UserInput == "D")
return
else if (UserInput == "1")
return
else if (UserInput == "2")
return
else if (UserInput == "3")
return
else if (UserInput == "4")
return
else if (UserInput == "5")
return
else if (UserInput == ","){
return
}else if (UserInput == "."){
return
}else if (UserInput == "6"){
return
}else if (UserInput == "b"){
return
}else if (UserInput == "c"){
Send, i
return
}else if (UserInput == "C"){
return
}else if (UserInput == "e"){
return
}else if (UserInput == "E"){
return
}else if (UserInput == "f"){
return
}else if (UserInput == "F"){
return
}else if (UserInput == "g"){
Send, ^g
;~ return
}else if (UserInput == "G"){
return
}else if (UserInput == "h"){
return
}else if (UserInput == "H"){
return
}else if (UserInput == "i"){
Send, ^i
;~ return
}else if (UserInput == "j"){
Send, ^j
return
}else if (UserInput == "k"){
return
}else if (UserInput == "l"){
return
}else if (UserInput == "m"){
return
}else if (UserInput == "n"){
send, ^n
send, {Enter}
return
}else if (UserInput == "o"){
send, ^o
return
}else if (UserInput == "p"){
return
}else if (UserInput == "q"){
QuickInputList=
(Ltrim
--[家庭]--
&2)甜甜
&b)爸爸
--[工作]--
&z)庄大彪
&Z)李大新
--[供应商]--
&j)胡瑛
&t)周丽娟
--[朋友]--
&w)李平
&e)李红钢
)
MySub_QuickInputtx(QuickInputList)
return
}else if (UserInput == "r"){
return
}else if (UserInput == "t"){
return
}else if (UserInput == "u"){
send ^+z
;~ return
}else if (UserInput == "v"){
Send, {NumpadAdd}
;~ return
}else if (UserInput == "x"){
send, x
;~ return
}else if (UserInput == "y"){
return
}else if (UserInput == "z"){
try {
SetTitleMatchMode RegEx
SetTitleMatchMode Slow
ControlClick, i).*确定|OK.*, A
} catch e {
ControlClick, Button1, A
}
return
}else if (UserInput == "Z"){
return
}else if (UserInput == "["){
return
}else if (UserInput == "]"){
return
}else if (UserInput == "/"){
;~ Run %a_scriptdir%\Apps\Word\Vim-Word.jpg
return
}else if (UserInput == "="){
return
}else if (UserInput == "-"){
return
}else
Send, {Blind}%UserInput%
}
}
return
;}


MySub_QuickInputtx(String){
menu,KyMenu_QuickInput,Add
menu,KyMenu_QuickInput,DeleteAll
Loop,parse,String,`n,`r
{
if (A_LoopField="")
continue
if (A_LoopField="-")
menu,KyMenu_QuickInput,Add
else
menu,KyMenu_QuickInput,Add,% A_LoopField,KyMenu_QuickInput_Handlertx
}
menu,KyMenu_QuickInput,show
return

KyMenu_QuickInput_Handlertx:
PostMessage, 0x50, 0, 0x4090409, , A ;切换为英文 0x4090409=67699721
outputStr:=substr(A_ThisMenuItem,4,strlen(A_ThisMenuItem))
;~ if GetKeyState("Shift")
;~ Stringupper, outputStr, outputStr
sendinput ^!z
Sleep 300
SendInput {raw}%outputStr%
Sleep 300
SendInput {Enter}
PostMessage, 0x50, 0, 0x8040804, , A ;切换为中文 0x8040804=134481924
return
}

AnyKeyPressedOtherThanSpace(mode = "P") {
keys = 1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop, Parse, keys
{
isDown := GetKeyState(A_LoopField, mode)
if(isDown)
return True
}
return False
}
@cy18 大神你好,我改动了的代码最新版本 1.1.28.02 下是可用的,可以使用空格加“任何大写字母” 或 F1-12、tab、win、`( 1 左边的那个)、方向键。。。。完整代码如下::
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
StringCaseSense, On
@cy18 顺便也变通解决了你说的按住空格不放不能重复输入空格的唯一的问题,我是按一直空格+tab 来重复输入空格的,这个很简单::
else if (ErrorLevel="EndKey:Tab")
SendInput, {Blind}{Space}

加以上语句就可以的了
@cy18 我在你的基础上修改了一下,加入空格加大写和 F1-12、tab、win、Ctrl、方向键。。。。相当于稍微扩展了下,代码如何给你 呢 可以麻烦你 加群 271105729 吗,这个是 ahk 的 爱好群,里面很多 ahk 的大神
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3322 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 12:13 · PVG 20:13 · LAX 04:13 · JFK 07:13
Developed with CodeLauncher
♥ Do have faith in what you're doing.