Guest User

Untitled

a guest
Dec 14th, 2023
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Persistent
  3. CoordMode "Mouse"
  4. ProcessSetPriority "B"
  5. scrcpy := "ahk_exe scrcpy.exe"
  6.  
  7. ^!p::  ; Ctrl+Alt+P
  8. {
  9.     TriggerScrcpy(false)
  10. }
  11.  
  12. ^!o::  ; Ctrl+Alt+O
  13. {
  14.     TriggerScrcpy(true)
  15. }
  16.  
  17. TriggerScrcpy(otgMode)
  18. {
  19.     if WinExist(scrcpy) {
  20.         WinActivate
  21.         Send "{Alt}"         
  22.     } else {
  23.         SetWorkingDir "C:\Util\scrcpy"
  24.        
  25.         if (otgMode) {
  26.             Run "scrcpy-noconsole.vbs --otg -s 12345678901234" ; replace with your USB Device ID
  27.             WinWait(scrcpy)
  28.             WinGetPos , , &w, &h
  29.             WinMove -5, A_ScreenHeight - h - 35
  30.             SetTimer CheckMousePos, 250
  31.         } else {
  32.             Run "scrcpy-noconsole.vbs"
  33.         }
  34.     }
  35.    
  36.     ;WinMoveBottom
  37. }
  38.  
  39. CheckMousePos()
  40. {
  41.     if not WinExist(scrcpy)
  42.         return
  43.        
  44.     MouseGetPos &xpos, &ypos
  45.     zone := xpos > 1 ? 0 : Max(Ceil(3 * ypos / A_ScreenHeight), 1)
  46.  
  47.     Switch zone {
  48.         Case 1: ;top
  49.         Case 2: ;middle
  50.         {
  51.         if GetKeyState("LAlt")
  52.             TriggerScrcpy(true)
  53.         }
  54.         Case 3: ;bottom
  55.     }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment