-
Notifications
You must be signed in to change notification settings - Fork 0
/
PasteMenu.ahk
40 lines (34 loc) · 1.44 KB
/
PasteMenu.ahk
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
; ========================= Global settings =========================
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force ; Ensures only one instance of this script is running at a time
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#UseHook On ; Ensures that a hotkey does not trigger another one.
RunScript(command)
{
PYTHON=c:\Miniconda3\envs\Python39\python.exe
SCRIPT=c:\Repository\ConvertPathOnPaste\convert_path.py
RunWait, %PYTHON% %SCRIPT% %command%
Sleep, 100
SendInput ^v
}
NormalizePath := Func("RunScript").Bind("normalize")
DoubleBackslashes := Func("RunScript").Bind("double")
ForwardBackslashes := Func("RunScript").Bind("forward")
ToCygPath := Func("RunScript").Bind("to_cygpath")
FromCygpath := Func("RunScript").Bind("from_cygpath")
Menu, PasteMenu, Add, NormalizePath, % NormalizePath
Menu, PasteMenu, Add, DoubleBackslashes, % DoubleBackslashes
Menu, PasteMenu, Add, ForwardBackslashes, % ForwardBackslashes
Menu, PasteMenu, Add, ToCygPath, % ToCygPath
Menu, PasteMenu, Add, FromCygpath, % FromCygpath
Hotkey, #+v, ShowMenu, On
return
; action when hotkey is pressed
ShowMenu:
{
;show menu at current mouse position
MouseGetPos, mX, mY
Menu, PasteMenu, Show, %mX%, %mY%
return
}