mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 00:54:04 +01:00
Fix syntax errors
This commit is contained in:
parent
9ed577c0d8
commit
fb208f3814
@ -1,4 +1,4 @@
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Converts .DOCX file(s) into Markdown
|
||||
.DESCRIPTION
|
||||
@ -27,7 +27,7 @@ try {
|
||||
Write-Host "⏳ Converting..."
|
||||
gci -r -i $FilePattern | foreach {
|
||||
$TargetPath = $_.directoryname + "\" + $_.basename + ".md"
|
||||
pandoc -f docx -s $_.name -o $TargetPath
|
||||
& pandoc -f docx -s $_.name -o $TargetPath
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
|
||||
|
||||
gci -r -i *.md |foreach{$docx=$_.directoryname+"\"+$_.basename+".docx";pandoc -f markdown -s --citeproc $_.name -o $docx}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<#
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Converts Markdown file(s) into HTML
|
||||
.DESCRIPTION
|
||||
|
@ -16,11 +16,11 @@
|
||||
param([string]$file = "")
|
||||
|
||||
try {
|
||||
if ($file -eq "" ) { $file = read-host "Enter path to file" }
|
||||
if ($file -eq "" ) { $file = Read-Host "Enter path to file" }
|
||||
|
||||
$Result = get-filehash $file -algorithm MD5
|
||||
$Result = Get-Filehash $file -algorithm MD5
|
||||
|
||||
"✔️ MD5 hash is" $Result.Hash
|
||||
"✔️ MD5 hash is $($Result.Hash)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -20,7 +20,7 @@ try {
|
||||
|
||||
$Result = get-filehash $file -algorithm SHA1
|
||||
|
||||
"✔️ SHA1 hash is" $Result.Hash
|
||||
"✔️ SHA1 hash is $($Result.Hash)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -20,7 +20,7 @@ try {
|
||||
|
||||
$Result = get-filehash $file -algorithm SHA256
|
||||
|
||||
"✔️ SHA256 hash is:" $Result.Hash
|
||||
"✔️ SHA256 hash is: $($Result.Hash)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -15,7 +15,7 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$symlink = "", $[string]target = "")
|
||||
param([string]$symlink = "", [string]$target = "")
|
||||
|
||||
try {
|
||||
if ($symlink -eq "" ) { $symlink = read-host "Enter new symlink filename" }
|
||||
|
@ -18,7 +18,7 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$TargetIP = "", [int]$TargetPort = 0, $[string]Message = "")
|
||||
param([string]$TargetIP = "", [int]$TargetPort = 0, [string]$Message = "")
|
||||
|
||||
try {
|
||||
if ($TargetIP -eq "" ) { $TargetIP = read-host "Enter target IP address" }
|
||||
|
@ -22,7 +22,7 @@ param([string]$File = "", [string]$SourceLang = "", [string]$TargetLang = "")
|
||||
function UseLibreTranslate { param([string]$Text, [string]$SourceLang, [string]$TargetLang)
|
||||
$Parameters = @{"q"="$Text"; "source"="$SourceLang"; "target"="$TargetLang"; }
|
||||
$Result = (Invoke-WebRequest -Uri https://libretranslate.com/translate -Method POST -Body ($Parameters|ConvertTo-Json) -ContentType "application/json").content | ConvertFrom-Json
|
||||
start-sleep -milliseconds 3000 # 20 requests per minute maximum
|
||||
Start-Sleep -milliseconds 3000 # 20 requests per minute maximum
|
||||
return $Result.translatedText
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ function DetectSourceLang { param([string]$Filename)
|
||||
}
|
||||
|
||||
function TranslateFilename { param([string]$Filename, [string]$SourceLang, [string]$TargetLang)
|
||||
[string]$SourceLanguage = ""
|
||||
if ($SourceLang -eq "de") { $SourceLanguage = "Deutsch" }
|
||||
if ($SourceLang -eq "en") { $SourceLanguage = "English" }
|
||||
if ($SourceLang -eq "fr") { $SourceLanguage = "Français" }
|
||||
|
Loading…
Reference in New Issue
Block a user