-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-ClipITS.ps1
59 lines (56 loc) · 2.96 KB
/
Get-ClipITS.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function Get-ClipITS {
Param(
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)][switch]$json,
[Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)][switch]$clip
)
Add-Type -AssemblyName PresentationCore
$output = New-Object System.Collections.ArrayList($null) #@() # An Array for the retuned objects to go into
[Windows.Clipboard]::GetText().Split("`n") | ForEach-Object {$output.add($PSItem)>$null}
if ($output.count -gt 1) {
$last = $output.count-1
$output.removeat($last)
}
$output = $output.replace("`r","").split("`t")
if ($json) {
$output = $output | convertto-json -compress
if ($clip){$output | clip}
return $output
}
else {
if ($clip){$output | clip}
return $output
}
}
# SIG # Begin signature block
# MIIFwQYJKoZIhvcNAQcCoIIFsjCCBa4CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU9XPe2Dv8npXR9GiqyxMmB91Q
# EaGgggNOMIIDSjCCAjKgAwIBAgIQIBPntLmZnK5B5G5IDj1xLDANBgkqhkiG9w0B
# AQsFADAoMSYwJAYDVQQDDB1wZW5ubGF3c2Nob29sLm9ubWljcm9zb2Z0LmNvbTAe
# Fw0yMjExMjExNDAzMDhaFw0zMjExMjExNDEzMDhaMCgxJjAkBgNVBAMMHXBlbm5s
# YXdzY2hvb2wub25taWNyb3NvZnQuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
# MIIBCgKCAQEAmK7TlA3wGi383lYrziQmsQaC0tpReqlPxnox69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