Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- #SingleInstance Force
- SendMode Input
- SetWorkingDir %A_ScriptDir%
- ; ======================================================================
- ; CONFIGURACIÓN INICIAL Y BÚSQUEDA AUTOMÁTICA DE RUTA (v1.0.2)
- ; ======================================================================
- global rutaSyncplay := ""
- global ultimoEnlace := ""
- global scriptPausado := false
- global cantNotificaciones := 0
- rutasComunes := ["C:\Program Files\Syncplay\SyncplayConsole.exe"
- , "C:\Program Files (x86)\Syncplay\SyncplayConsole.exe"
- , A_ProgramFiles . "\Syncplay\SyncplayConsole.exe"
- , "C:\Users\" . A_UserName . "\AppData\Local\Programs\Syncplay\SyncplayConsole.exe"]
- for index, ruta in rutasComunes {
- if (FileExist(ruta)) {
- rutaSyncplay := ruta
- break
- }
- }
- if (rutaSyncplay == "") {
- 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.
- ExitApp
- }
- Menu, Tray, NoStandard
- Menu, Tray, Add, 🟢 Reactivar / ⏸️ Pausar Script, AlternarPausa
- Menu, Tray, Add, 🔄 Reenviar Último Enlace, ReenviarUltimo
- Menu, Tray, Add
- Menu, Tray, Add, ❌ Salir de AutoSyncPlay, SalirScript
- Menu, Tray, Default, 🟢 Reactivar / ⏸️ Pausar Script
- Menu, Tray, Tip, AutoSyncPlay v1.0.2
- CrearNotificacion("🟢 AutoSyncPlay listo", "Green")
- OnClipboardChange("AlCopiarAlgo", 1)
- return
- ; ======================================================================
- ; ATAJOS DE TECLADO GLOBALES
- ; ======================================================================
- ^!v:: GoSub, ReenviarUltimo ; Ctrl + Alt + V -> Reenviar el último enlace guardado
- ^!p:: GoSub, AlternarPausa ; Ctrl + Alt + P -> Pausar / Activar el detector de enlaces
- ; ======================================================================
- ; SENSOR AUTOMÁTICO DEL PORTAPAPELES
- ; ======================================================================
- AlCopiarAlgo(Tipo) {
- if (scriptPausado || Tipo != 1)
- return
- if (!WinActive("ahk_exe stremio-shell-ng.exe") && !WinActive("ahk_exe Nuvio.exe"))
- return
- enlace := Clipboard
- if !(InStr(enlace, "http://") || InStr(enlace, "https://") || InStr(enlace, "magnet:"))
- return
- OnClipboardChange("AlCopiarAlgo", 0)
- ultimoEnlace := enlace
- CrearNotificacion("🔗 Enlace detectado para Syncplay...", "Blue")
- OnClipboardChange("AlCopiarAlgo", 1)
- Sleep, 300
- GoSub, DesplegarStreaming
- }
- return
- DesplegarStreaming:
- If (WinExist("ahk_exe SyncplayConsole.exe") && WinExist("ahk_exe mpv.exe"))
- {
- GoSub, ActivarYPegar
- }
- Else
- {
- CrearNotificacion("Iniciando Syncplay...", "Orange")
- Run, "%rutaSyncplay%", , Min
- WinWait, ahk_exe mpv.exe, , 10
- If (ErrorLevel = 0)
- {
- GoSub, ActivarYPegar
- }
- Else
- {
- CrearNotificacion("⚠️ Error: MPV tardó demasiado", "Red")
- }
- }
- return
- ActivarYPegar:
- WinActivate, ahk_exe mpv.exe
- WinWaitActive, ahk_exe mpv.exe, , 2
- Sleep, 200
- OnClipboardChange("AlCopiarAlgo", 0)
- Clipboard := ultimoEnlace
- Sleep, 50
- Send, ^v
- Sleep, 400
- ; --- LIMPIEZA DEL PORTAPAPELES ---
- Clipboard := ""
- Sleep, 50
- OnClipboardChange("AlCopiarAlgo", 1)
- Send, f
- CrearNotificacion("✅ Enlace enviado y Maximizado!", "Green")
- return
- AlternarPausa:
- scriptPausado := !scriptPausado
- if (scriptPausado) {
- Menu, Tray, Rename, 🟢 Reactivar / ⏸️ Pausar Script, 🟢 Reactivar Script
- Menu, Tray, Check, 🟢 Reactivar Script
- CrearNotificacion("⏸️ AutoSyncPlay pausado", "Orange")
- } else {
- Menu, Tray, Rename, 🟢 Reactivar Script, 🟢 Reactivar / ⏸️ Pausar Script
- Menu, Tray, Uncheck, 🟢 Reactivar / ⏸️ Pausar Script
- CrearNotificacion("🟢 AutoSyncPlay activo", "Green")
- }
- return
- ReenviarUltimo:
- if (ultimoEnlace == "") {
- CrearNotificacion("⚠️ No hay enlaces en memoria", "Red")
- return
- }
- CrearNotificacion("🔄 Reenviando último enlace...", "Blue")
- GoSub, DesplegarStreaming
- return
- SalirScript:
- ExitApp
- return
- CrearNotificacion(texto, colorTexto) {
- static TextoMedido
- cantNotificaciones++
- idGui := cantNotificaciones + 10
- Gui, %idGui%:+AlwaysOnTop -Caption +ToolWindow +E0x20
- Gui, %idGui%:Color, 1A1A1A
- Gui, %idGui%:Font, s12 bold c%colorTexto%, Segoe UI
- Gui, %idGui%:Add, Text, x15 y12 vTextoMedido, %texto%
- GuiControlGet, TextoPos, %idGui%:Pos, TextoMedido
- anchoCartel := TextoPosW + 30
- altoCartel := 45
- espaciado := 10
- SysGet, Mon, MonitorWorkArea
- xPos := MonRight - anchoCartel - 20
- yPos := MonTop + 20 + ((cantNotificaciones - 1) * (altoCartel + espaciado))
- Gui, %idGui%:Show, x%xPos% y%yPos% w%anchoCartel% h%altoCartel% NoActivate
- WinSet, Transparent, 255, ahk_id %idGui%
- ContadorBorrado := Func("IniciarFadeOut").Bind(idGui)
- SetTimer, %ContadorBorrado%, -4500
- }
- IniciarFadeOut(idGui) {
- Loop, 15 {
- transparencia := 255 - (A_Index * 17)
- WinSet, Transparent, %transparencia%, ahk_id %idGui%
- Sleep, 20
- }
- Gui, %idGui%:Destroy
- cantNotificaciones--
- if (cantNotificaciones < 0)
- cantNotificaciones := 0
- }
Advertisement
Add Comment
Please, Sign In to add comment