1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#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 ENTER [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(427,399) [System.Windows.Forms.SendKeys]::SendWait("powershell") [System.Windows.Forms.SendKeys]::SendWait("{ENTER}") |