-2
私は数日間試してきましたが、ここでロジックを把握することはできません。タオルに投げ込む。forループ内の文がループで実行されない場合
私は画像オブジェクトを持っています。これを10 "x 8"の等しいセルのグリッドに切り詰めます。 10番目の列の後、次の行にドロップし、その後の10個の列などを収集すると仮定します。私はそれを次の行に再帰させて、その行に置いておくのではなく、1つのセルを取得して最初の行に戻します。
$startColumn = 1
$currentCell = 1
$currentColumn = 1
$currentRow = 1
For($i = 1; $i -lt 81; $i++)
{
$startleftCoord = 292
$starttopCoord = 87
$startrightCoord = 390
$startbottomCoord = 162
$cellheight = 75
$cellwidth = 98
if ($firstiterationcomplete -eq 1) {
"Changing columns"
$startleftCoord = $startleftCoord+($currentColumn*$cellwidth)+(4.05*$currentColumn)
$startrightCoord = $startrightCoord+($currentColumn*$cellwidth)+(4.05*$currentColumn)
if ($currentColumn -eq 9) {
"Changing Rows"
$currentRow++
$currentColumn = $startColumn
$startleftCoord = $startleftCoord
$startrightCoord = $startrightCoord
$starttopCoord = $starttopCoord+($currentRow*$cellheight)+(4.25*$currentRow)
$startbottomCoord = $startbottomCoord+($currentRow*$cellheight)+(4.25*$currentRow)
}
}
"Curent column is " + $currentColumn
"Row count is " + $currentRow
#save cellshot
$cellBounds = [Drawing.Rectangle]::FromLTRB($startleftCoord,$starttopCoord, $startrightCoord, $startbottomCoord)
$cellObject = New-Object Drawing.Bitmap $cellBounds.Width, $cellBounds.Height
$cellGraphics = [Drawing.Graphics]::FromImage($cellObject)
$cellGraphics.CopyFromScreen($cellBounds.Location, [Drawing.Point]::Empty, $cellBounds.Size)
$cellGraphics.Dispose()
$cellObject.Save($FilePath)
$currentColumn++
$currentCell++
$firstiterationcomplete = 1
"Saved CELLSHOT to $FilePath."
}
をスキップされ、次の理由を簡単に説明が不足している?あなたのコードにはPHP、Pythonの、またはforeachループが含まれていません。 – melpomene
だけにそれを編集しましたforループを含める...私は専門家ではなく、仕事をやろうとしています。それはpowershellです –
私はそれがpowershellだと知っています。なぜPHPとPythonとforeachにタグを付けましたか? – melpomene