Commit 63918751 authored by whzecomjm's avatar whzecomjm
Browse files

first commit

parents
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line

#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.



;---------------------一键拷贝文件路径 Ctrl+Shift+c ---------------------
; 该功能已被Listary和 TC 的功能替换
^+c::
; null= 
send ^c
sleep,200
clipboard=%clipboard% ;%null%
tooltip,%clipboard%
sleep,500
tooltip,
return


;---------------------计时器---------------------
#t::
InputBox, time, 简单计时器, 请输入一个时间(单位是秒)
; 弹出一个输入框,标题是“煎蛋牌泡面专用计时器”,内容是“请输入一个时间(单位是秒)”
time := time*1000
; 如果一个变量要做计算的话,一定要像这样写,和平常的算式相比,多了一个冒号。sleep 的时间是按照千分之一秒算的,这里乘以 1000 就变成秒了。
Sleep,%time%
MsgBox 时间到了
return


;下面的内容放在长注释也有问题,所以就单独(使用Emeditor)注释了。


; ================= 颜色抓取====================
#c::
;配置Alt+Win+c按键
MouseGetPos, mouseX, mouseY
; 获得鼠标所在坐标,把鼠标的 X 坐标赋值给变量 mouseX ,同理 mouseY
PixelGetColor, color, %mouseX%, %mouseY%, RGB
; 调用 PixelGetColor 函数,获得鼠标所在坐标的 RGB 值,并赋值给 color
StringRight color,color,6
; 截取 color(第二个 color)右边的6个字符,因为获得的值是这样的:#RRGGBB,一般我们只需要 RRGGBB 部分。把截取到的值再赋给 color(第一个 color)。
clipboard = %color%
; 把 color 的值发送到剪贴板
tooltip, 鼠标所在颜色值已发送到剪贴板。
; tooltip 弹出鼠标提示的命令,后面加上要显示的语句。中间的 `n 表示回车
sleep 2000
; 时间暂停 两秒
tooltip,
; 关闭鼠标提示
return

Hot strings.ahk

0 → 100644
+55 −0
Original line number Diff line number Diff line
#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.

;=====================热字串助手~win+H自动添加==================
#h::  ; Win+H 热键
; 获取当前选择的文本. 使用剪贴板代替
; "ControlGet Selected", 是因为它可以工作于更大范围的编辑器
; (即文字处理软件). 保存剪贴板当前的内容
; 以便在后面恢复. 尽管这里只能处理纯文本,
; 但总比没有好:
AutoTrim Off  ; 保留剪贴板中任何前导和尾随空白字符.
ClipboardOld := ClipboardAll
Clipboard := ""  ; 必须清空, 才能检测是否有效.
Send ^c
ClipWait 1
if ErrorLevel  ; ClipWait 超时.
    return
; 替换 CRLF 和/或 LF 为 `n 以便用于 "发送原始模式的" 热字串:
; 对其他任何在原始模式下可能出现问题
; 的字符进行相同的处理:
StringReplace, Hotstring, Clipboard, ``, ````, All  ; 首先进行此替换以避免和后面的操作冲突.
StringReplace, Hotstring, Hotstring, `r`n, ``r, All  ; 在 MS Word 等软件中中使用 `r 会比 `n 工作的更好.
StringReplace, Hotstring, Hotstring, `n, ``r, All
StringReplace, Hotstring, Hotstring, %A_Tab%, ``t, All
StringReplace, Hotstring, Hotstring, `;, ```;, All
Clipboard := ClipboardOld  ; 恢复剪贴板之前的内容.
; 这里会移动 InputBox 的光标到更人性化的位置:
SetTimer, MoveCaret, 10
; 显示 InputBox, 提供默认的热字串:
InputBox, Hotstring, New Hotstring, Type your abreviation at the indicated insertion point. You can also edit the replacement text if you wish.`n`nExample entry: :R:btw`::by the way,,,,,,,, :R:`::%Hotstring%
if ErrorLevel  ; 用户选择了取消.
    return
if InStr(Hotstring, ":R`:::")
{
    MsgBox You didn't provide an abbreviation. The hotstring has not been added.
    return
}
; 否则添加热字串并重新加载脚本:
FileAppend, `n%Hotstring%, %A_ScriptFullPath%  ; 在开始处放置 `n 以防文件末尾没有空行.
Reload
Sleep 200 ; 如果加载成功, reload 会在 Sleep 期间关闭当前实例, 所以永远不会执行到下面的语句.
MsgBox, 4,, The hotstring just added appears to be improperly formatted. Would you like to open the script for editing? Note that the bad hotstring is at the bottom of the script.
IfMsgBox, Yes, Edit
return

MoveCaret:
IfWinNotActive, New Hotstring
    return
; 否则移动 InputBox 中的光标到用户输入缩写的位置.
Send {Home}{Right 3}
SetTimer, MoveCaret, Off
return

Key Remapping.ahk

0 → 100644
+39 −0
Original line number Diff line number Diff line
#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.

;---------------------修改CapsLock键---------------------
;修改CapsLock为enter键,CapsLock改为Alt+CapsLock
$CapsLock::Enter
LAlt & Capslock::SetCapsLockState, % GetKeyState("CapsLock", "T") ? "Off" : "On"

;---------------------修改右边Appskey为鼠标左键,ctrl为右键---------------------
RAlt::LButton ;右边Alt修改为鼠标左键
$RAlt::Click ;只能使用点击,不能拖拽
#MaxHotKeysPerInterval	200000000
$AppsKey::RButton ; 
$RCtrl::!^Tab
;修改Fn为Numlk是不可能的,Fn见是写在硬件上的,无法通过软件改变

; ---------------------将删除改为永久删除---------------------
Del::
send +{delete}
sleep, 500
Send {Enter}
return


;---------------------隐藏windows任务栏功能---------------------
^`::
IfWinExist,ahk_class Shell_TrayWnd
{
WinHide ahk_class Shell_TrayWnd ;隐藏任务栏
}
Else
{
WinShow ahk_class Shell_TrayWnd ;显示任务栏
}
return

Notepad3.ahk

0 → 100644
+51 −0
Original line number Diff line number Diff line
#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.

;=================================使用notepad3快速打开文件=============================
; 现在使用 TC, 自带 F4 编辑.

Explorer_GetSelection(hwnd="")   ;函数
{  
    WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")  
    WinGetClass class, ahk_id %hwnd%  
    if (process != "explorer.exe")  
        return  
    if (class ~= "Progman|WorkerW") {  
            ControlGet, files, List, Selected Col1, SysListView321, ahk_class %class%  
            Loop, Parse, files, `n, `r  
                ToReturn .= A_Desktop "\" A_LoopField "`n"  
        } else if (class ~= "(Cabinet|Explore)WClass") {  
            for window in ComObjCreate("Shell.Application").Windows 
			{
				try{
                if (window.hwnd==hwnd)  
                    sel := window.Document.SelectedItems  
				}catch e {
					continue
				}
			}
            for item in sel  
                ToReturn .= item.path "`n"  
        }  
    return Trim(ToReturn,"`n")  
}


$#n:: 
;win+n 打开文件, 如果listary 工具栏存在使用 listary 自带
;如果没有选中文件, 则新建 notpad3 窗口, 无效时关闭 explorer 窗口重新打开即可
IfWinActive ahk_class Listary_WidgetWin_0
{
Send #n
return
}
else
{
path :=% Explorer_GetSelection(hwnd) ;调用了函数
Software = D:\Program Files\TotalCMD\Tools\Notepad3.exe
Run, %Software% "%path%"
return
}
 No newline at end of file

Toggle Apps.ahk

0 → 100644
+58 −0
Original line number Diff line number Diff line
#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.
#SingleInstance force  ;脚本正在运行时, 启动该脚本时会跳过对话框并自动替换旧实例.
#NoTrayIcon  ;不显示托盘图标


; ======================== 程序快速切换===================
;指定程序之间 的 快捷键切换,如果没打开则打开
;链接:https://www.zhihu.com/question/19645501/answer/637425288
RunOrActivateProgram(Program, WorkingDir="", WindowSize=""){ 
    SplitPath Program, ExeFile 
    Process, Exist, %ExeFile% 
    PID = %ErrorLevel% 
    if (PID = 0) { 
    Run, %Program%, %WorkingDir%, %WindowSize% 
    }else{ 
    WinActivate, ahk_pid %PID% 
    } 
}

!z:: ;打开or切换Chrome浏览器  Alt+Z
RunOrActivateProgram("C:\Users\whzec\Documents\Cent\App\chrome.exe")
return 

!x:: ;打开or切换pdf Alt+X
RunOrActivateProgram("D:\Program Files\PDF-XChange Editor Plus\PDFXEdit.exe")
return

;打开or切换notepad3 Alt+N
!n::
RunOrActivateProgram("D:\Program Files\NotePad3\Notepad3\Notepad3.exe")
return 

;打开or切换Typora
;之前只有Typora不灵,这种方式就可以诶
!c::   ;Alt+C
DetectHiddenWindows, On
SetTitleMatchMode, 2
WinGet, winid, ID, Typora
;MsgBox,%winid%
SetTitleMatchMode, 1
If (winid) {
WinWait, ahk_id %winid%
WinShow
WinActivate
ControlFocus, EditComponent2, A
ControlSetText, EditComponent2,, A
}else{
RunOrActivateProgram("D:\Program Files\Typora\Typora.exe")
}
DetectHiddenWindows, Off
return