Created
August 17, 2014 22:29
-
-
Save zamber/ac2ff92371496b74a68c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# MTSH (MoreTerra Simple Helper) v0.1.0 | |
# PowerShell 3.0 | |
# | |
# Generate world images from Terraria world with MoreTerra | |
# Configure and fork it as you see fit. | |
# | |
# To schedule it as a task follow this http://j.mp/schedule-powershell | |
# | |
# To host it use http://cestana.com/mongoose.shtml | |
# | |
# Remember to http://j.mp/powershell-dl Get-Help About_Signing | |
# | |
# @author Piotr Zaborowski | |
# @license CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0/ | |
# | |
# # config | |
$root = "C:\Users\zamber\Documents" | |
$mt = "$root\MoreTerra" | |
$worlds = "$root\My Games\Terraria\Worlds" | |
$dest = "$root\World Maps" | |
$log = "$root\World Maps\log.txt" | |
Function Log { | |
Param ([String]$logstring) | |
$date = Get-Date -UFormat %c | |
Add-Content $log -Value "$date : $logstring" | |
} | |
function Main { | |
Log "Starting ----------------------------------------------------------" | |
Get-ChildItem $worlds\* -Include *.wld | % { | |
$image = "$dest\" + $_.Name + ".png" | |
$worldPath = $_.FullName | |
$args = "-w `"$worldPath`" -o `"$image`"" | |
Log "Running $mt\MoreTerra.exe $args" | |
Start-Process "cmd.exe" "/c $mt\MoreTerra.exe $args" -Wait | |
Log "Done" | |
} | |
} | |
Main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently Task Scheduler fails at running it. Shows "Success" and the images are not generated.
Probably Start-Process is an issue here. Running directly maybe will fix it?