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 |
#Importar función para hacer clic $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 #Arrancar Google Chrome $url='https://www.google.es' Start-Process chrome.exe -ArgumentList @('-incognito',$url) #Esperar hasta cargar Google Chrome Start-Sleep -Seconds 5 #Escribir una palabra y pulsar en el segundo enlace que aparece en la función Autocompletar [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(427,399) [System.Windows.Forms.SendKeys]::SendWait("powershell") [System.Windows.Forms.SendKeys]::SendWait(" ") Start-Sleep -Seconds 2 [System.Windows.Forms.SendKeys]::SendWait("m") Start-Sleep -Seconds 1 [System.Windows.Forms.SendKeys]::SendWait("i") Start-Sleep -Seconds 1 [System.Windows.Forms.SendKeys]::SendWait("c") Start-Sleep -Seconds 1 [System.Windows.Forms.SendKeys]::SendWait("{DOWN 2}") [System.Windows.Forms.SendKeys]::SendWait("{ENTER}") |