Upload files to "/"
This commit is contained in:
60
readScreenshot.ps1
Normal file
60
readScreenshot.ps1
Normal file
@@ -0,0 +1,60 @@
|
||||
$global:LDPlayerPath ="C:\Ldplayer\LDplayer9"
|
||||
|
||||
function logger($logMessage) {
|
||||
$scriptName = Split-Path -Leaf $PSCommandPath
|
||||
$timestamp = date
|
||||
$timestampedLogMessage = $timestamp + "--$scriptName--:" + $logMessage
|
||||
$logFilePath = "$global:LDPlayerPath\LDAutoLog.txt"
|
||||
$fs = New-Object System.IO.FileStream($logFilePath, [System.IO.FileMode]::Append, [System.IO.FileAccess]::Write, [System.IO.FileShare]::Read)
|
||||
$sw = New-Object System.IO.StreamWriter($fs)
|
||||
try {
|
||||
$sw.WriteLine($timestampedLogMessage)
|
||||
} finally {
|
||||
$sw.Close()
|
||||
$fs.Close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#$adbOut= adb -s 10.0.211.121 shell screencap -p /sdcard/screenshot.png 2>$null
|
||||
#$adbPull= adb -s 10.0.211.121 pull /sdcard/screenshot.png
|
||||
adb connect 10.0.211.121 *>$null
|
||||
adb -s 10.0.211.121 exec-out screencap -p > $global:LDPlayerPath\screenshot.png
|
||||
|
||||
& "C:\Program Files\Tesseract-OCR\tesseract.exe" "$global:LDPlayerPath\screenshot.png" "$global:LDPlayerPath\tesseract" -l eng tsv
|
||||
|
||||
$tsvFile = "$global:LDPlayerPath\tesseract.tsv"
|
||||
|
||||
$wordCoords = Get-Content $tsvFile | ConvertFrom-Csv -Delimiter "`t"
|
||||
$wordCoords | Where-Object ($_.level -eq 5) | Select-Object text, left, top, width, height
|
||||
|
||||
|
||||
$Data=$wordCoords | ForEach-Object {
|
||||
$x1 =[int]$_._left
|
||||
$y1 =[int]$_.top
|
||||
$x2 = $x1 + [int]$_.width
|
||||
$y2 = $y1 + [int]$_.height
|
||||
|
||||
$midX =[math]::Round(($x1+$x2)/2)
|
||||
$midY =[math]::Round(($y1+$y2)/2)
|
||||
|
||||
[PSCustomObject]@{
|
||||
Text = $_.text
|
||||
X1 = $x1
|
||||
Y1 = $y1
|
||||
X2 = $x2
|
||||
Y2 = $y2
|
||||
MidX = $midX
|
||||
MidY = $midY
|
||||
Coords = "$midX $midY"
|
||||
}
|
||||
}
|
||||
|
||||
$wordCoords | Format-Table
|
||||
$Data | Format-Table
|
||||
$coordsForText = $Data["Show"].Coords
|
||||
$cordsForText
|
||||
|
||||
$showCoords = $Data | Where-Object {$_.Text -and $_.Text.ToLower() -eq 'show'}
|
||||
|
||||
$showCoords.Coords
|
||||
Reference in New Issue
Block a user