summaryrefslogtreecommitdiff
path: root/texmf-dist/doc/latex/thorshammer/system-scripts/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'texmf-dist/doc/latex/thorshammer/system-scripts/standalone')
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/altclasspaths.txt1
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/cpquizzes.ps151
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkcfg.ps171
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps160
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/rmquizzes.ps151
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/runps1.bat2
-rw-r--r--texmf-dist/doc/latex/thorshammer/system-scripts/standalone/sample-list.csv3
7 files changed, 239 insertions, 0 deletions
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/altclasspaths.txt b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/altclasspaths.txt
new file mode 100644
index 00000000..67953493
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/altclasspaths.txt
@@ -0,0 +1 @@
+# C:\Users\IEUser\Desktop\TestClass1
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/cpquizzes.ps1 b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/cpquizzes.ps1
new file mode 100644
index 00000000..04e50266
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/cpquizzes.ps1
@@ -0,0 +1,51 @@
+# This script copies PDFs from the $startLocations to $destPath, but only
+# if in a $baseName folder
+$baseName="_Thor"
+$classPath="C:\Users\dpstory\Desktop\Test Folder\target\myClass"
+$destPath="C:\Users\dpstory\Desktop\Test Folder\target\_Thor\grade"
+# Strip-and-Trim function
+# Remove everything to the left of a comment character, then trim
+function Strip-and-Trim {
+ param([string]$str)
+ $pos=$str.IndexOf("#")
+ If($pos -ne -1) {
+ $str=$str.substring(0,$pos)
+ }
+ $str=$str.trim()
+ return $str
+}
+# vars
+$startLocations=@($classPath)
+Write-Host ""
+if(Test-Path -Path ./altclasspaths.txt) {
+ get-content ./altclasspaths.txt | %{
+ $str= Strip-and-Trim($_)
+ if($str) {
+ Write-Host "Reading alternate path: $str"
+ $startLocations+=$str
+ }
+ }
+}
+$instrDest="$PWD\fromStudents"
+#
+# script starts here
+#
+$currentPath=Convert-Path .
+foreach ($startLocation in $startLocations) {
+ Set-Location $startLocation
+ $numCopied=0
+ Write-Host "`nCopying any PDFs files from within a `"$baseName`" subfolder of `
+`"$startLocation`" to `
+`"$instrDest`""
+ Get-ChildItem -Path . -Filter "*.pdf" -Recurse |
+ Where-Object { $_.DirectoryName -match $baseName } -OutVariable fileName |
+ Copy-Item -Destination $destPath
+ if ($fileName.Name -eq $null) {Write-Host "`nNo files to copy"}
+ else {
+ Write-Host "`nReport:"
+ $numCopied=$fileName.Name.Count
+ $fileName.Name
+ }
+ Write-Host @( Get-ChildItem $PWD ).Count "folders examined, $numCopied files copied"
+ cd $currentPath
+}
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkcfg.ps1 b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkcfg.ps1
new file mode 100644
index 00000000..53d67946
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkcfg.ps1
@@ -0,0 +1,71 @@
+# Make a complete cfg for thorshammer package from a csv list
+# accepted list delimiters: , or ;. Spaces ar not allowed! Replace all german umlauts
+# with ue, oe, ae, ss to avoid problems with thorshammer package
+#
+$classPath="C:\Users\dpstory\Desktop\Test Folder\target\myClass"
+$instrPath="C:\Users\dpstory\Desktop\Test Folder\target\_Thor"
+# Example list:
+# First Name|Last Name|Folder
+# Anton;Müller;AM29914M
+#\classMember{Anton}{Mueller}{AM299/instructor-name}
+# Anton;Müller;*C:/.../AM299
+#\classMember{Anton}{Mueller}*{C:/.../AM299/instructor-name}
+#
+If ( $args.Length -eq 0 ) {
+ Write-Host "A CSV file of the class members is required," `
+ "see documentation"
+ exit
+} else {
+ $listName=$args[0]
+ if(Test-Path -Path ./$listName.csv) {
+ } else {
+ Write-Host "Cannot find the file `"$listName.csv`" in the current folder," `
+ "check the spelling, do not include the extension."
+ exit
+ }
+}
+get-content "$listName.csv" | foreach {
+"\classMember{" + $_ `
++ "/_Thor}" `
+-Replace ";", "}{" `
+-Replace ",","}{" `
+-Replace "{\*", "*{" } | Set-Content "convertedList.cfg"
+
+# Store convertedList.cfg in a variable
+$convertedListCfg = get-content .\convertedList.cfg -Raw
+
+# function to replace umlauts
+# https://www.datenteiler.de/powershell-umlaute-ersetzen/
+function Replace-Umlaute ([string]$s) {
+ $UmlautObject = New-Object PSObject | Add-Member -MemberType NoteProperty -Name Name -Value $s -PassThru
+
+ # hash tables are by default case insensitive
+ # we have to create a new hash table object for case sensitivity
+
+ $characterMap = New-Object system.collections.hashtable
+ $characterMap.ä = "ae"
+ $characterMap.ö = "oe"
+ $characterMap.ü = "ue"
+ $characterMap.ß = "ss"
+ $characterMap.Ä = "Ae"
+ $characterMap.Ü = "Ue"
+ $characterMap.Ö = "Oe"
+
+ foreach ($property in "Name") {
+ foreach ($key in $characterMap.Keys) {
+ $UmlautObject.$property = $UmlautObject.$property -creplace $key,$characterMap[$key]
+ }
+ }
+ $UmlautObject
+}
+
+# replace umlauts in .cfg and make a correctedListCfg
+$correctedListCfg = Replace-Umlaute "$convertedListCfg"
+$correctedListCfg.Name
+
+# Finally append correctedListCfg to desired
+# cfg file, usually 00-class.cfg
+add-content "00-class.cfg" "\classPath{$classPath)"
+add-content "00-class.cfg" "\instrPath{$instrPath}"
+add-content "00-class.cfg" $correctedListCfg.Name
+Remove-Item convertedList.cfg
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1 b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1
new file mode 100644
index 00000000..7f7fcc3e
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1
@@ -0,0 +1,60 @@
+$classPath="C:\Users\dpstory\Desktop\Test Folder\target\myClass"
+# Create class folders
+If ( $args.Length -eq 0 ) {
+ Write-Host "A CVS file of the class members is required," `
+ "see documentation"
+ exit
+} else {
+ $listName=$args[0]
+ if(Test-Path -Path ./$listName.csv) {
+ } else {
+ Write-Host "Cannot find the file `"$listName.csv`" in the current folder," `
+ "check the spelling, do not include the extension."
+ exit
+ }
+}
+get-content "$listName.csv" | foreach {
+$_ +">_Thor" -Replace ";","," } | Set-Content "commaList.csv"
+
+$argList=@()
+get-content "commaList.csv" | %{
+# Write-Host "$_"
+ $split=$_.split(",")
+# Write-Host $split[2]
+ $argList+=$split[2]
+}
+$currentPath=Convert-Path .
+cd $classPath
+Write-Host "Creating folder structure at `$classPath`"," `
+ "with some exceptions"
+for ($i=0; $i -lt $argList.length; $i++) {
+ $arg=$argList[$i]
+ $splitTwo=$argList[$i].split(">")
+ $firstName=$splitTwo[0]
+ $secondName=$splitTwo[1]
+ if ($firstName[0] -eq "*") {
+ $arg=$arg.substring(1)
+ $msg="Parsing the full path $arg" -Replace ">","/"
+ Write-Host $msg
+ Write-Host "Creating exceptional folders"
+ $firstName=$firstName.substring(1)
+#Write-Host "$firstName"
+ Write-Host " Creating folder: $firstName"
+ New-Item $firstName -ErrorAction:Ignore -ItemType directory
+ $secondName=$firstName+"/$secondName"
+#Write-Host "$secondName"
+ Write-Host " Creating folder: $secondName"
+ New-Item $secondName -ErrorAction:Ignore -ItemType directory
+ } else {
+ $msg="Parsing the relative path $arg" -Replace ">","/"
+ Write-Host $msg
+ Write-Host " Creating folder: $firstName"
+ New-Item $firstName -ErrorAction:Ignore -ItemType directory
+ cd $firstName
+ Write-Host " Creating subfolder of $firstName named: $secondName"
+ New-Item $secondName -ErrorAction:Ignore -ItemType directory
+ cd ..
+ }
+}
+cd $currentPath
+Remove-Item commaList.csv
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/rmquizzes.ps1 b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/rmquizzes.ps1
new file mode 100644
index 00000000..02b35341
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/rmquizzes.ps1
@@ -0,0 +1,51 @@
+# Get-ExecutionPolicy
+# Set-ExecutionPolicy RemoteSigned
+# This script removes (deletes) PDFs from the $startLocation, but only if in a $baseName folder
+$baseName="_Thor"
+$classPath="C:\Users\dpstory\Desktop\Test Folder\target\myClass"
+#
+# Strip-and-Trim function
+# Remove everything to the left of a comment character, then trim
+function Strip-and-Trim {
+ param([string]$str)
+ $pos=$str.IndexOf("#")
+ If($pos -ne -1) {
+ $str=$str.substring(0,$pos)
+ }
+ $str=$str.trim()
+ return $str
+}
+# vars
+$startLocations=@($classPath)
+Write-Host ""
+if(Test-Path -Path ./altclasspaths.txt) {
+ get-content ./altclasspaths.txt | %{
+ $str= Strip-and-Trim($_)
+ if($str) {
+ Write-Host "Reading alternate path: $str"
+ $startLocations+=$str
+ }
+ }
+}
+$instrDest="$PWD\fromStudents"
+#
+# script starts here
+#
+$currentPath=Convert-Path .
+foreach ($startLocation in $startLocations) {
+ Set-Location $startLocation
+ $numDel=0
+ Write-Host "`nDeleting the following PDFs files from within a `"$baseName`" subfolder of `
+`"$startLocation`""
+ Get-ChildItem -Path . -Filter "*.pdf" -Recurse |
+ Where-Object { $_.DirectoryName -match $baseName } -OutVariable fileName |
+ Remove-Item
+ if ($fileName.Name -eq $null) {Write-Host "`nNo files to delete"}
+ else {
+ Write-Host "`nReport: deleting files,"
+ $numDel=$fileName.Name.Count
+ $fileName.Name
+ }
+ Write-Host @( Get-ChildItem $PWD ).Count "folders examined, $numDel files deleted"
+ cd $currentPath
+}
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/runps1.bat b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/runps1.bat
new file mode 100644
index 00000000..5960b5ba
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/runps1.bat
@@ -0,0 +1,2 @@
+rem echo "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+PowerShell.exe -ExecutionPolicy Bypass -Command "& './%1' %2"
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/sample-list.csv b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/sample-list.csv
new file mode 100644
index 00000000..0f97aa0a
--- /dev/null
+++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/sample-list.csv
@@ -0,0 +1,3 @@
+Mühle;Wäter;MW634B
+Anton,Müller,AM256M
+Laura,Vögt,LM356B