mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 17:14:28 +01:00
Rename to save-screenshot.ps1
This commit is contained in:
parent
7b8922af8d
commit
83ce93a7ae
@ -195,6 +195,7 @@ remove-print-jobs.ps1, Removes all jobs from all printers
|
||||
remove-tag.ps1, Removes a tag in a Git repository
|
||||
replace-in-files.ps1, Search and replace a pattern in the given files by the replacement
|
||||
restart-network-adapters.ps1, Restarts all local network adapters
|
||||
save-screenshot.ps1, Saves a single screenshot
|
||||
say-date.ps1, Say the current date by text-to-speech
|
||||
say-joke.ps1, Say a random Chuck Norris joke by text-to-speech
|
||||
say-quote.ps1, Say a random quote by text-to-speech
|
||||
@ -226,8 +227,6 @@ start-ipfs-server.ps1, Starts a local IPFS server
|
||||
switch-branch.ps1, Switches the branch in the current/given Git repository (including submodules)
|
||||
switch-shelly1.ps1, Switches a Shelly1 device in the local network
|
||||
sync-repo.ps1, Synchronizes a Git repository by push & pull (including submodules)
|
||||
take-screenshot.ps1, Takes a single screenshot
|
||||
take-screenshots.ps1, Takes multiple screenshots
|
||||
translate-file.ps1, Translates the given text file into another language
|
||||
translate-files.ps1, Translates the given text files into any supported language
|
||||
translate-text.ps1, Translates the given text into other languages
|
||||
|
Can't render this file because it has a wrong number of fields in line 91.
|
@ -24,7 +24,7 @@ check-ping.ps1 [[-hosts] <String>] [<CommonParameters>]
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./check-ping
|
||||
✔️ 36 ms ping average (13 ms min, 109 ms max, 10 hosts)
|
||||
✔️ Ping is 36 ms average (13 ms min, 109 ms max, using 10 hosts)
|
||||
|
||||
```
|
||||
|
||||
|
@ -41,7 +41,7 @@ export-to-serenade.ps1 [[-WakeWord] <String>] [[-FilePattern] <String>] [[-Targe
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./export-to-serenade.ps1 Computer
|
||||
Exporting 264 scripts to C:\Users\Markus/.serenade/scripts/PowerShell.js...
|
||||
⏳ Exporting 264 scripts to C:\Users\Markus/.serenade/scripts/PowerShell.js...
|
||||
✔️ exported 264 PowerShell scripts to Serenade in 22 sec
|
||||
|
||||
```
|
||||
|
@ -1,17 +1,17 @@
|
||||
## take-screenshot.ps1 - Takes a single screenshot and saves it into a folder
|
||||
## save-screenshot.ps1 - Takes a single screenshot and saves it into a folder
|
||||
|
||||
This script takes a single screenshot and saves it into a folder.
|
||||
This script takes a single screenshot and saves it into a target folder (the user's pictures folder by default).
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
take-screenshot.ps1 [[-Directory] <String>] [<CommonParameters>]
|
||||
save-screenshot.ps1 [[-Directory] <String>] [<CommonParameters>]
|
||||
|
||||
-Directory <String>
|
||||
Specifies the target directory
|
||||
Specifies the target directory (the user's pictures folder by default)
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value "$PWD"
|
||||
Default value "$HOME/Pictures"
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
@ -22,7 +22,7 @@ take-screenshot.ps1 [[-Directory] <String>] [<CommonParameters>]
|
||||
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./take-screenshot C:\Temp
|
||||
PS> ./save-screenshot C:\Temp
|
||||
|
||||
```
|
||||
|
||||
@ -32,4 +32,4 @@ Author: Markus Fleschutz · License: CC0
|
||||
## Related Links
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
*Generated by convert-ps2md.ps1 using the comment-based help of take-screenshot.ps1*
|
||||
*Generated by convert-ps2md.ps1 using the comment-based help of save-screenshot.ps1*
|
@ -1,44 +0,0 @@
|
||||
## take-screenshots.ps1 - Takes screenshots and saves them into a folder
|
||||
|
||||
This script takes screenshots and saves them into a folder.
|
||||
|
||||
## Parameters
|
||||
```powershell
|
||||
take-screenshots.ps1 [[-TargetDir] <String>] [[-Interval] <Int32>] [<CommonParameters>]
|
||||
|
||||
-TargetDir <String>
|
||||
Specifies the path to the target folder
|
||||
|
||||
Required? false
|
||||
Position? 1
|
||||
Default value "$PWD"
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-Interval <Int32>
|
||||
Specifies the time interval in seconds (60 seconds per default)
|
||||
|
||||
Required? false
|
||||
Position? 2
|
||||
Default value 60
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
[<CommonParameters>]
|
||||
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
||||
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
||||
```
|
||||
|
||||
## Example
|
||||
```powershell
|
||||
PS> ./take-screenshots C:\Temp 60
|
||||
|
||||
```
|
||||
|
||||
## Notes
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
|
||||
## Related Links
|
||||
https://github.com/fleschutz/PowerShell
|
||||
|
||||
*Generated by convert-ps2md.ps1 using the comment-based help of take-screenshots.ps1*
|
@ -118,9 +118,8 @@ Mega Collection of PowerShell Scripts
|
||||
| [open-onedrive.ps1](Scripts/open-onedrive.ps1) | Opens the user's OneDrive folder | [Help](Docs/open-onedrive.md) |
|
||||
| [open-recycle-bin.ps1](Scripts/open-recycle-bin.ps1) | Starts the File Explorer with the recycle bin folder | [Help](Docs/open-recycle-bin.md) |
|
||||
| [remind-me.ps1](Scripts/remind-me.ps1) | Creates a scheduled task that will display a popup message | [Help](Docs/remind-me.md) |
|
||||
| [save-screenshot.ps1](Scripts/save-screenshot.ps1) | Saves a single screenshot | [Help](Docs/save-screenshot.md) |
|
||||
| [set-wallpaper.ps1](Scripts/set-wallpaper.ps1) | Sets the given image as wallpaper | [Help](Docs/set-wallpaper.md) |
|
||||
| [take-screenshot.ps1](Scripts/take-screenshot.ps1) | Takes a single screenshot | [Help](Docs/take-screenshot.md) |
|
||||
| [take-screenshots.ps1](Scripts/take-screenshots.ps1) | Takes multiple screenshots (every minute by default) | [Help](Docs/take-screenshots.md) |
|
||||
|
||||
📁 Scripts for Files & Folders
|
||||
-------------------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
.PARAMETER Directory
|
||||
Specifies the target directory (the user's pictures folder by default)
|
||||
.EXAMPLE
|
||||
PS> ./take-screenshot C:\Temp
|
||||
PS> ./save-screenshot C:\Temp
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
@ -1,45 +0,0 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Takes screenshots and saves them into a folder
|
||||
.DESCRIPTION
|
||||
This script takes screenshots and saves them into a folder.
|
||||
.PARAMETER TargetDir
|
||||
Specifies the path to the target folder
|
||||
.PARAMETER Interval
|
||||
Specifies the time interval in seconds (60 seconds per default)
|
||||
.EXAMPLE
|
||||
PS> ./take-screenshots C:\Temp 60
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
param([string]$TargetDir = "$PWD", [int]$Interval = 60) # in seconds
|
||||
|
||||
function TakeScreenshot { param([string]$FilePath)
|
||||
Add-Type -Assembly System.Windows.Forms
|
||||
$ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen
|
||||
$ScreenshotObject = New-Object Drawing.Bitmap $ScreenBounds.Width, $ScreenBounds.Height
|
||||
$DrawingGraphics = [Drawing.Graphics]::FromImage($ScreenshotObject)
|
||||
$DrawingGraphics.CopyFromScreen( $ScreenBounds.Location, [Drawing.Point]::Empty, $ScreenBounds.Size)
|
||||
$DrawingGraphics.Dispose()
|
||||
$ScreenshotObject.Save($FilePath)
|
||||
$ScreenshotObject.Dispose()
|
||||
}
|
||||
|
||||
try {
|
||||
do {
|
||||
$Time = (Get-Date)
|
||||
$Filename = "$($Time.Year)-$($Time.Month)-$($Time.Day)-$($Time.Hour)-$($Time.Minute)-$($Time.Second).png"
|
||||
$FilePath = (Join-Path $TargetDir $Filename)
|
||||
|
||||
write-output "Saving screenshot to $FilePath..."
|
||||
TakeScreenshot $FilePath
|
||||
Start-Sleep -Seconds $Interval
|
||||
} while (1)
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user