Scripting and security

Operating Systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Abrir vídeos de Youtube leyendo desde un fichero y enviar la reproducción a la Smart TV

Ofertas y promociones en Videojuegos

PowerShell
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
41
42
43
44
45
46
47
48
49
50
51
#El fichero contiene enlaces de Yotube
#https://www.youtube.com/watch?v=sNwpQwn5awY
#https://www.youtube.com/watch?v=ETradti7L4c
 
#Función para enviar la reproducción a la Smart TV
function EnviarSmartTV
{
#Importar DLL para simular el clic del ratón
#Es necesario poner las comillas correctamente cuando se importa la DLL user32.dll
$MouseEventSig=@’
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
‘@
$MouseEvent = Add-Type -memberDefinition $MouseEventSig -name “MouseEventWinApi” -passThru
 
#Depende de la resolución de pantalla
#Pulsar en "Personaliza y controla Google Chrome"
[System.Windows.Forms.Cursor]::Position=New-Object System.Drawing.Point(1347,43)
$MouseEvent::mouse_event(0x00000002, 0, 0, 0, 0)
$MouseEvent::mouse_event(0x00000004, 0, 0, 0, 0)
Start-Sleep -Seconds 5
 
#Nos posicionamos en la opción "Enviar"
[System.Windows.Forms.SendKeys]::SendWait(‘E')
Start-Sleep -Seconds 5
 
#Pulsar la tecla ENTER
[System.Windows.Forms.SendKeys]::SendWait(‘{ENTER}’)
Start-Sleep -Seconds 10
 
#Enviar youtube.com a la primera TV
[System.Windows.Forms.Cursor]::Position=New-Object System.Drawing.Point(653,153)
$MouseEvent::mouse_event(0x00000002, 0, 0, 0, 0)
$MouseEvent::mouse_event(0x00000004, 0, 0, 0, 0)
Start-Sleep -Seconds 5
 
#Pulsar en "ENVIAR"
[System.Windows.Forms.Cursor]::Position=New-Object System.Drawing.Point(705,173)
$MouseEvent::mouse_event(0x00000002, 0, 0, 0, 0)
$MouseEvent::mouse_event(0x00000004, 0, 0, 0, 0)
}
 
Get-Content E:\listadovideos.txt | % {
#Abrir enlace de Youtube
Start-Process chrome $_
#Enviar la reproducción a la Smart TV mediante la función EnviarSmartTV
EnviarSmartTV
#Esperar antes de reproducir el siguiente vídeo
Start-Sleep -Seconds 200
}

 

CATEGORÍAS

Automatización, Multimedia, PowerShell

ETIQUETAS

Add-Type, Chrome, Drawing, Function, Get-Content, Google, Google Chrome, HTTPS, Jesús Niño Camazón, mouse_event, MouseEventWinApi, New-Object, SendWait, Smart, Smart TV, Start-Process, Start-Sleep, System.Drawing, System.Drawing.Point, System.Windows.Forms.Cursor, System.Windows.Forms.SendKeys, user32.dll, Watch, Windows, Youtube

MÁS

  • Cómo depurar scripts en ISE de Windows PowerShell
  • Técnico Superior en Administración de Sistemas Informáticos en Red
  • Automatizar el movimiento del ratón en el sistema operativo Windows con PowerShell
  • Ejercicios de PowerShell: realizar operaciones en un equipo remoto
  • 11. Gestión del Directorio Activo (nivel intermedio)
  • Práctica sobre virus
619576768 680208449 638920931 646891474 672611699 637968774 697953303 625849269 633380380 618917369 696094475 621207093 646230060 692095167 684354029 667263850 650107975 679868280 631375529 685275239 604688304 681650641 651010477 682697772 626392265 630378940 654347591 678495378 660322852 623829158 626592269 658130494 604269628 681213905 631129034 642443667 654409149 610356698 629063750 659534759 635712278 603681804 603066500 647518625 686420435 643278828 632704225 654369575 620602740 603169763 690919753 628626261 684081345 612637151 634947458 633963610 658772529 629860066 672897965 658763865 646262500 670974007 600633939 609626394 612736064 632268100 649988766 667242726 670385102 607338801