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 |
#Abrir por ejemplo google.es y realizar una búsqueda [Reflection.Assembly]::LoadWithPartialName("System.Drawing") function screenshot([Drawing.Rectangle]$bounds, $path) { $bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height $graphics = [Drawing.Graphics]::FromImage($bmp) $graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size) $bmp.Save($path) $graphics.Dispose() $bmp.Dispose() } #Cadena a buscar dentro de la captura $cadena='jesusninoc' for($i=220; $i -ne 720; $i+=100) { $i $bounds = [Drawing.Rectangle]::FromLTRB(120, $i, 680, $i+100) $fichero='F:\power\captura'+$i+'.png' screenshot $bounds $fichero cd 'C:\Program Files (x86)\Tesseract-OCR' $ficheroout='F:\power\captura'+$i .\tesseract.exe $fichero $ficheroout -l spa $ficherocontxt=$ficheroout+'.txt' $contenido=Get-Content $ficherocontxt -Encoding UTF8 $contenido if($contenido -match $cadena) { $i+20 | Out-File f:\power\posiciones.txt -Append } } |