From 8cc0c8a34aba421ba30c51e6dd09cd8dcd705a6c Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Dec 2020 21:40:32 +0100 Subject: [PATCH 1/2] add #3 (New-PSOneQRCodeURI) --- QRCodeGenerator/2.3/New-PSOneQRCodeURI.ps1 | 59 ++++++++++++++++++++++ QRCodeGenerator/2.3/QRCodeGenerator.psd1 | 6 +-- QRCodeGenerator/2.3/aliases.ps1 | 3 +- 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 QRCodeGenerator/2.3/New-PSOneQRCodeURI.ps1 diff --git a/QRCodeGenerator/2.3/New-PSOneQRCodeURI.ps1 b/QRCodeGenerator/2.3/New-PSOneQRCodeURI.ps1 new file mode 100644 index 0000000..5f0caa6 --- /dev/null +++ b/QRCodeGenerator/2.3/New-PSOneQRCodeURI.ps1 @@ -0,0 +1,59 @@ +function New-PSOneQRCodeURI +{ + <# + .SYNOPSIS + Creates a QR code graphic containing a URI + + .DESCRIPTION + Creates a QR code graphic in png format that - when scanned by a smart device - opens a URI/URL in your webapp + + .PARAMETER URI + The URI + + .PARAMETER Width + Height and Width of generated graphics (in pixels). Default is 100. + + .PARAMETER Show + Opens the generated QR code in associated program + + .PARAMETER OutPath + Path to generated png file. When omitted, a temporary file name is used. + + .EXAMPLE + New-PSOneQRCodeURI -URI "https://github.com/TobiasPSP/Modules.QRCodeGenerator" -Width 50 -Show -OutPath "$home\Desktop\qr.png" + Creates a QR code png graphics on your desktop, and opens it with the associated program + + .NOTES + Compatible with all PowerShell versions including PowerShell 6/Core + Uses binaries from https://github.com/codebude/QRCoder/wiki + + .LINK + https://github.com/TobiasPSP/Modules.QRCodeGenerator + #> + + [CmdletBinding()] + param + ( + [Parameter(Mandatory)] + [alias("URL")] + [System.Uri] + $URI, + + [ValidateRange(10,2000)] + [int] + $Width = 100, + + [Switch] + $Show, + + [string] + $OutPath = "$env:temp\qrcode.png" + ) + +$payload = @" + +$($URI.AbsoluteUri) +"@ + + New-PSOneQRCode -payload $payload -Show $Show -Width $Width -OutPath $OutPath +} \ No newline at end of file diff --git a/QRCodeGenerator/2.3/QRCodeGenerator.psd1 b/QRCodeGenerator/2.3/QRCodeGenerator.psd1 index 715b49c..30ba679 100644 --- a/QRCodeGenerator/2.3/QRCodeGenerator.psd1 +++ b/QRCodeGenerator/2.3/QRCodeGenerator.psd1 @@ -9,17 +9,17 @@ Copyright = '2020 Dr. Tobias Weltner (MIT-License)' Description = 'creates QR codes offline' PowerShellVersion = '5.1' FunctionsToExport = 'New-PSOneQRCodeGeolocation', 'New-PSOneQRCodeTwitter', - 'New-PSOneQRCodeWifiAccess', 'New-PSOneQRCodeVCard', 'New-PSOneQRCodeText' + 'New-PSOneQRCodeWifiAccess', 'New-PSOneQRCodeVCard', 'New-PSOneQRCodeText' , 'New-PSOneQRCodeURI' CmdletsToExport = '*' VariablesToExport = '*' AliasesToExport = 'New-QRCodeGeolocation', 'New-QRCodeTwitter', 'New-QRCodeVCard', - 'New-QRCodeWifiAccess', 'New-QRCodeText' + 'New-QRCodeWifiAccess', 'New-QRCodeText', 'New-QRCodeURI' PrivateData = @{ PSData = @{ Tags = 'QRCode', 'powershell.one' LicenseUri = 'https://en.wikipedia.org/wiki/MIT_License' ProjectUri = 'https://github.com/TobiasPSP/Modules.QRCodeGenerator' - ReleaseNotes = 'added new Method New-QRCodeText' + ReleaseNotes = 'added new Methods New-QRCodeText and New-QRCodeURI' } } } diff --git a/QRCodeGenerator/2.3/aliases.ps1 b/QRCodeGenerator/2.3/aliases.ps1 index e15ee20..350d6e5 100644 --- a/QRCodeGenerator/2.3/aliases.ps1 +++ b/QRCodeGenerator/2.3/aliases.ps1 @@ -3,4 +3,5 @@ Set-Alias -Name New-QRCodeGeolocation -Value New-PSOneQRCodeGeolocation Set-Alias -Name New-QRCodeWifiAccess -Value New-PSOneQRCodeWifiAccess Set-Alias -Name New-QRCodeTwitter -Value New-PSOneQRCodeTwitter Set-Alias -Name New-QRCodeVCard -Value New-PSOneQRCodeVCard -Set-Alias -Name New-QRCodeText -Value New-PSOneQRCodeText \ No newline at end of file +Set-Alias -Name New-QRCodeText -Value New-PSOneQRCodeText +Set-Alias -Name New-QRCodeURI -Value New-PSOneQRCodeURI \ No newline at end of file From 1c0d0b3c60649f1c6f2f1c330ab88332a02004e5 Mon Sep 17 00:00:00 2001 From: Tobias Date: Fri, 8 Jan 2021 11:28:10 +0100 Subject: [PATCH 2/2] Added New-QRCodeURI to README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9316ca5..5bf2b10 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,6 @@ New-QRCodeText New-QRCodeTwitter New-QRCodeVCard New-QRCodeWifiAccess +New-QRCodeURI ```