sirmarvado99

AutoSynplay v3.1

Jul 6th, 2026
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.51 KB | None | 0 0
  1. #NoEnv
  2. #SingleInstance Force
  3. SendMode Input
  4. SetWorkingDir %A_ScriptDir%
  5.  
  6. ; ======================================================================
  7. ; CONFIGURACIÓN INICIAL Y BÚSQUEDA AUTOMÁTICA DE RUTA (v1.0.2)
  8. ; ======================================================================
  9. global rutaSyncplay := ""
  10. global ultimoEnlace := ""
  11. global scriptPausado := false
  12. global cantNotificaciones := 0
  13.  
  14. rutasComunes := ["C:\Program Files\Syncplay\SyncplayConsole.exe"
  15. , "C:\Program Files (x86)\Syncplay\SyncplayConsole.exe"
  16. , A_ProgramFiles . "\Syncplay\SyncplayConsole.exe"
  17. , "C:\Users\" . A_UserName . "\AppData\Local\Programs\Syncplay\SyncplayConsole.exe"]
  18.  
  19. for index, ruta in rutasComunes {
  20. if (FileExist(ruta)) {
  21. rutaSyncplay := ruta
  22. break
  23. }
  24. }
  25.  
  26. if (rutaSyncplay == "") {
  27. MsgBox, 16, Error de AutoSyncPlay, No se ha podido encontrar SyncplayConsole.exe automáticamente.`nPor favor, asegúrate de tener Syncplay instalado en tu sistema.
  28. ExitApp
  29. }
  30.  
  31. Menu, Tray, NoStandard
  32. Menu, Tray, Add, 🟢 Reactivar / ⏸️ Pausar Script, AlternarPausa
  33. Menu, Tray, Add, 🔄 Reenviar Último Enlace, ReenviarUltimo
  34. Menu, Tray, Add
  35. Menu, Tray, Add, ❌ Salir de AutoSyncPlay, SalirScript
  36. Menu, Tray, Default, 🟢 Reactivar / ⏸️ Pausar Script
  37. Menu, Tray, Tip, AutoSyncPlay v1.0.2
  38.  
  39. CrearNotificacion("🟢 AutoSyncPlay listo", "Green")
  40. OnClipboardChange("AlCopiarAlgo", 1)
  41. return
  42.  
  43. ; ======================================================================
  44. ; ATAJOS DE TECLADO GLOBALES
  45. ; ======================================================================
  46. ^!v:: GoSub, ReenviarUltimo ; Ctrl + Alt + V -> Reenviar el último enlace guardado
  47. ^!p:: GoSub, AlternarPausa ; Ctrl + Alt + P -> Pausar / Activar el detector de enlaces
  48.  
  49. ; ======================================================================
  50. ; SENSOR AUTOMÁTICO DEL PORTAPAPELES
  51. ; ======================================================================
  52. AlCopiarAlgo(Tipo) {
  53. if (scriptPausado || Tipo != 1)
  54. return
  55.  
  56. if (!WinActive("ahk_exe stremio-shell-ng.exe") && !WinActive("ahk_exe Nuvio.exe"))
  57. return
  58.  
  59. enlace := Clipboard
  60. if !(InStr(enlace, "http://") || InStr(enlace, "https://") || InStr(enlace, "magnet:"))
  61. return
  62.  
  63. OnClipboardChange("AlCopiarAlgo", 0)
  64. ultimoEnlace := enlace
  65. CrearNotificacion("🔗 Enlace detectado para Syncplay...", "Blue")
  66. OnClipboardChange("AlCopiarAlgo", 1)
  67.  
  68. Sleep, 300
  69. GoSub, DesplegarStreaming
  70. }
  71. return
  72.  
  73. DesplegarStreaming:
  74. If (WinExist("ahk_exe SyncplayConsole.exe") && WinExist("ahk_exe mpv.exe"))
  75. {
  76. GoSub, ActivarYPegar
  77. }
  78. Else
  79. {
  80. CrearNotificacion("Iniciando Syncplay...", "Orange")
  81. Run, "%rutaSyncplay%", , Min
  82. WinWait, ahk_exe mpv.exe, , 10
  83.  
  84. If (ErrorLevel = 0)
  85. {
  86. GoSub, ActivarYPegar
  87. }
  88. Else
  89. {
  90. CrearNotificacion("⚠️ Error: MPV tardó demasiado", "Red")
  91. }
  92. }
  93. return
  94.  
  95. ActivarYPegar:
  96. WinActivate, ahk_exe mpv.exe
  97. WinWaitActive, ahk_exe mpv.exe, , 2
  98. Sleep, 200
  99.  
  100. OnClipboardChange("AlCopiarAlgo", 0)
  101. Clipboard := ultimoEnlace
  102. Sleep, 50
  103.  
  104. Send, ^v
  105. Sleep, 400
  106.  
  107. ; --- LIMPIEZA DEL PORTAPAPELES ---
  108. Clipboard := ""
  109. Sleep, 50
  110. OnClipboardChange("AlCopiarAlgo", 1)
  111.  
  112. Send, f
  113. CrearNotificacion("✅ Enlace enviado y Maximizado!", "Green")
  114. return
  115.  
  116. AlternarPausa:
  117. scriptPausado := !scriptPausado
  118. if (scriptPausado) {
  119. Menu, Tray, Rename, 🟢 Reactivar / ⏸️ Pausar Script, 🟢 Reactivar Script
  120. Menu, Tray, Check, 🟢 Reactivar Script
  121. CrearNotificacion("⏸️ AutoSyncPlay pausado", "Orange")
  122. } else {
  123. Menu, Tray, Rename, 🟢 Reactivar Script, 🟢 Reactivar / ⏸️ Pausar Script
  124. Menu, Tray, Uncheck, 🟢 Reactivar / ⏸️ Pausar Script
  125. CrearNotificacion("🟢 AutoSyncPlay activo", "Green")
  126. }
  127. return
  128.  
  129. ReenviarUltimo:
  130. if (ultimoEnlace == "") {
  131. CrearNotificacion("⚠️ No hay enlaces en memoria", "Red")
  132. return
  133. }
  134. CrearNotificacion("🔄 Reenviando último enlace...", "Blue")
  135. GoSub, DesplegarStreaming
  136. return
  137.  
  138. SalirScript:
  139. ExitApp
  140. return
  141.  
  142. CrearNotificacion(texto, colorTexto) {
  143. static TextoMedido
  144. cantNotificaciones++
  145. idGui := cantNotificaciones + 10
  146.  
  147. Gui, %idGui%:+AlwaysOnTop -Caption +ToolWindow +E0x20
  148. Gui, %idGui%:Color, 1A1A1A
  149. Gui, %idGui%:Font, s12 bold c%colorTexto%, Segoe UI
  150. Gui, %idGui%:Add, Text, x15 y12 vTextoMedido, %texto%
  151. GuiControlGet, TextoPos, %idGui%:Pos, TextoMedido
  152.  
  153. anchoCartel := TextoPosW + 30
  154. altoCartel := 45
  155. espaciado := 10
  156.  
  157. SysGet, Mon, MonitorWorkArea
  158. xPos := MonRight - anchoCartel - 20
  159. yPos := MonTop + 20 + ((cantNotificaciones - 1) * (altoCartel + espaciado))
  160.  
  161. Gui, %idGui%:Show, x%xPos% y%yPos% w%anchoCartel% h%altoCartel% NoActivate
  162. WinSet, Transparent, 255, ahk_id %idGui%
  163.  
  164. ContadorBorrado := Func("IniciarFadeOut").Bind(idGui)
  165. SetTimer, %ContadorBorrado%, -4500
  166. }
  167.  
  168. IniciarFadeOut(idGui) {
  169. Loop, 15 {
  170. transparencia := 255 - (A_Index * 17)
  171. WinSet, Transparent, %transparencia%, ahk_id %idGui%
  172. Sleep, 20
  173. }
  174. Gui, %idGui%:Destroy
  175. cantNotificaciones--
  176. if (cantNotificaciones < 0)
  177. cantNotificaciones := 0
  178. }
Advertisement
Add Comment
Please, Sign In to add comment