1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#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.
; 定义程序路径
obsidianPath := "C:\Users\Administrator\AppData\Local\Obsidian\Obsidian.exe"
chromePath := "C:\Program Files\Google\Chrome\Application\chrome.exe"
solidworksPath := "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\SOLIDWORKS 2021\SOLIDWORKS 2021"
; 定义快捷键 Alt+1
!1::
; 检查Obsidian是否已经打开
IfWinExist, ahk_exe obsidian.exe
{
; 如果已经打开,激活Obsidian窗口
WinActivate
}
else
{
; 如果未打开,启动Obsidian软件
Run, %obsidianPath%
}
return
; -------------打开Chrome-------------
; 定义快捷键 Alt+2
!2::
; 检查Chrome是否已经打开
IfWinExist, ahk_exe chrome.exe
{
; 如果已经打开,激活Chrome窗口
WinActivate
}
else
{
; 如果未打开,启动Chrome软件
Run, %chromePath%
}
return
; -------------打开Solidworks-------------
; 定义快捷键 Alt+3
!3::
; 检查SolidWorks是否已经打开
IfWinExist, ahk_exe SLDWORKS.exe
{
; 如果已经打开,激活SolidWorks窗口
WinActivate
}
else
{
; 如果未打开,启动SolidWorks软件
Run, %solidworksPath%
}
return
|