diff --git a/AutoHotkey_2.0.0/WinTitles.ahk b/AutoHotkey_2.0.0/WinTitles.ahk new file mode 100644 index 0000000..5b7a7dc --- /dev/null +++ b/AutoHotkey_2.0.0/WinTitles.ahk @@ -0,0 +1,23 @@ +; WinTitle reference: https://autohotkey.com/docs/misc/WinTitle.htm#multi +class WinTitles +{ + static ModernApp := "ahk_class ApplicationFrameWindow ahk_exe ApplicationFrameHost.exe" + + static ModernSkype := [WinTitles.ModernApp, "Skype"] + static ModernPhotos := [WinTitles.ModernApp, "Photos"] + static Vlc := "ahk_exe vlc.exe" + static IntellijIdea := "ahk_exe idea64.exe" + static CorsairCUE := "ahk_class CUEBorderlessWindow ahk_exe iCUE.exe" + static BattleNet := "ahk_exe Battle.net.exe" + static Firefox := "ahk_class MozillaWindowClass" + static Chrome := "ahk_class Chrome_WidgetWin_1" + static Skype := "ahk_exe Skype.exe" + static TeamViewerSponsoredSession := "Sponsored session ahk_exe TeamViewer.exe" + static TeamViewer := "TeamViewer ahk_exe TeamViewer.exe" + static ACDSee := "ahk_exe ACDSeeProfessional2018.exe" + static Feces := "ahk_exe Teams.exe" + static Telegram := "ahk_exe telegram.exe ahk_class Qt5154QWindowIcon" + static SublimeText := "ahk_exe sublime_text.exe" + static tf2 := "ahk_exe hl2.exe" + static windowsCredentials := "Windows Security" +} diff --git a/AutoHotkey_2.0.0/app_handling.ahk b/AutoHotkey_2.0.0/app_handling.ahk index 4b03ed6..f4193cc 100644 --- a/AutoHotkey_2.0.0/app_handling.ahk +++ b/AutoHotkey_2.0.0/app_handling.ahk @@ -1,5 +1,5 @@ #Include WinTitles.ahk -;#include lib/clipboard.ahk +#include lib/clipboard.ahk ;; There is no need for a standard ahk auto-execute area anymore because of this method. @@ -236,25 +236,26 @@ Ctrl & Home::Home Ctrl & End::End #HotIf -;CapsLock & v:: -; openInMpv() { -; saveClipboard() -; -; Send {Blind}^l -; Sleep 100 -; Send {Blind}^a -; Sleep 100 -; Send {Blind}^c -; ClipWait 1 -; -; Tippy("Opening mpv with: " Clipboard) -; Run % "D:\all\all\mpv.net\mpvnet.exe " Clipboard -; -; restoreClipboard() -; } -; -; -; +;----------------------- +; Open an url in MPV +CapsLock & v:: { + saveClipboard() + + Send "{Blind}^l" + Sleep 100 + Send "{Blind}^a" + Sleep 100 + Send "{Blind}^c" + ClipWait 1 + +; Tippy("Opening mpv with: " A_Clipboard) + Run("D:\all\all\mpv.net\mpvnet.exe " A_Clipboard) + + restoreClipboard() +} + + + ;----------------------- ; Microshitsoft Teams is fucking retarded ; diff --git a/AutoHotkey_2.0.0/lib/clipboard.ahk b/AutoHotkey_2.0.0/lib/clipboard.ahk new file mode 100644 index 0000000..4979473 --- /dev/null +++ b/AutoHotkey_2.0.0/lib/clipboard.ahk @@ -0,0 +1,16 @@ +saveClipboard() { + ; Try is needed because I get an error "can't open clipboard for reading" while lock screen is on + Try { + global __ClipboardSaved := ClipboardAll() + A_Clipboard := "" + } +} + +restoreClipboard() +{ + Try { + global __ClipboardSaved + A_Clipboard := __ClipboardSaved ; Restore Clipboard + __ClipboardSaved := "" + } +} diff --git a/app_handling.ahk b/app_handling.ahk index a3ba29a..b340ce9 100644 --- a/app_handling.ahk +++ b/app_handling.ahk @@ -41,62 +41,6 @@ startAndResizeTelegram() x := A_ScreenWidth - w y := 0 WinMove, % WinTitles.Telegram, , x, y, w, h - - - - ; another method of moving telegram to its desired position. - ; this also bugges sometimes - ; save initial mouse pos - ; CoordMode Mouse, Screen - ; MouseGetPos, initial_x, initial_y - - ; SetDefaultMouseSpeed 40 - ; CoordMode Mouse, Window - - ; ; move mouse to starting position of resize process - ; MouseMove, 100, 16 - - ; SendInput {LButton} - ; SendInput {LButton} - ; Sleep 90 - - ; MouseMove, 100, 16 - - - ; ; do a windows right-snap (resize window to half the screen, right side) - ; SendInput {LButton down} - ; CoordMode Mouse, Screen ;; this coordMode trickery has to be done for each movement. - ; MouseMove, A_ScreenWidth, A_ScreenHeight/2 - ; CoordMode Mouse, Window - ; SendInput {LButton up} - - - ; Sleep 90 - - ; ; set the desired window size - ; MouseMove, -1, 200 - ; SendInput {LButton down} - ; CoordMode Mouse, Screen - ; MouseMove, A_ScreenWidth - A_ScreenWidth/3, 200 - ; CoordMode Mouse, Window - ; SendInput {LButton up} - - ; ; ; de-snap the window, so that the size is remembered. - ; ; ; windows is retarded and does not remember the size/position for snapped windows. - ; ; MouseMove, 200, 16 - ; ; SendInput {LButton down} - ; ; MouseMove, -10, 0,,R - ; ; SendInput {LButton up} - ; ; Sleep 90 - ; ; SendInput {LButton down} - ; ; MouseMove, 10, 0,,R - ; ; SendInput {LButton up} - ; ; Sleep 90 - - - ; ; move the mouse back to the original position - ; CoordMode Mouse, Screen - ; MouseMove, initial_x, initial_y } else { WinActivate % WinTitles.Telegram @@ -112,32 +56,3 @@ startAndResizeTelegram() getTaskbarDimensions(ByRef tw, ByRef th) { WinGetPos, x, y, tw, th, ahk_class Shell_TrayWnd } - - - - - - - - - - - - - -CapsLock & v:: - openInMpv() { - saveClipboard() - - Send {Blind}^l - Sleep 100 - Send {Blind}^a - Sleep 100 - Send {Blind}^c - ClipWait 1 - - Tippy("Opening mpv with: " Clipboard) - Run % "D:\all\all\mpv.net\mpvnet.exe " Clipboard - - restoreClipboard() - }