上次抛砖引玉,这次我自己接上了
作用就是向微信发送东西,代码有注释,另外附上各个参数的判断逻辑导图一张
gosub pcname
!c::
wechat(1,"jl","82DM","文件")
return
wechat(copy:=1,who:=0,pc:="82DM",IfNotMyComputer:="jl"){
global pcname
MsgBox,% pcname copy who pc IfNotMyComputer
(copy==1) ? copy() : temp:=1
(who==0) ? WechatSend(0)
: pc!=pcname ? WechatSend(who)
: WechatSend(IfNotMyComputer)
MsgBox,% pcname copy who pc IfNotMyComputer
}
WechatSend(who){
if WinExist("ahk_exe WeChat.exe")
WinActivate
else
send,^!w
WinActivate ahk_exe WeChat.exe
if (who=0)
ControlSend,,{Ctrl down}v{Ctrl up},微信
else{
sleep 200
ControlSend,,{Ctrl down}f{Ctrl up} %who%,微信
Sleep 600
ControlSend,,{Enter},微信
Sleep 300
ControlSend,,{Ctrl down}v{Ctrl up},微信
Sleep 400
ControlSend,,{Enter},微信
}
}
Copy(){
Clipboard:=""
Send,^c
ClipWait,1,1
return Clipboard
}
pcname:
command_pcname = wmic csproduct get name
pcname := cmdSilenceReturn(command_pcname)
pcname := StrReplace(pcname, A_Space, "")
pcname := StrReplace(pcname, "`r`n")
pcname := SubStr(pcname, 5, StrLen(pcname))
Return
cmdSilenceReturn(command){
CMDReturn:=""
cmdFN:="RunAnyCtrlCMD"
try{
RunWait,% ComSpec " /C " command " > ""%Temp%\" cmdFN ".log""",, Hide
FileRead, CMDReturn, %A_Temp%\%cmdFN%.log
FileDelete,%A_Temp%\%cmdFN%.log
}catch{}
return CMDReturn
}
F10:: Reload
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
可以