Bonjour,

Par le biais d'un script PowerShell, je souhaite ouvrir un site web sélectionner/copier son contenu (Control-A/Control-C) puis ouvrir un éditeur de texte par exemple notepad pour coller les infos collectées.

Pour cela j'utilise le script ci-dessous qui ouvre bien le site et notepad, mais pas de sélection (ni copier/coller).

Pour info je suis débutant ... si qq peux m’éclairer merci pour votre réponse

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
 
$Process = Start-Process "firefox.exe"  "http://monsite-web/index.php"
Start-Sleep -Milliseconds 500
[Microsoft.VisualBasic.Interaction]::AppActivate($Process.Id)
[System.Windows.Forms.SendKeys]::SendWait("^{A}")
[System.Windows.Forms.SendKeys]::SendWait("^{C}")

$Process = Start-Process notepad.exe -PassThru
Start-Sleep -Milliseconds 500
[Microsoft.VisualBasic.Interaction]::AppActivate($Process.Id)
[System.Windows.Forms.SendKeys]::SendWait("^{V}")
Start-Sleep -Seconds 3