Skip to content

Instantly share code, notes, and snippets.

@zamber
Created August 17, 2014 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamber/ac2ff92371496b74a68c to your computer and use it in GitHub Desktop.
Save zamber/ac2ff92371496b74a68c to your computer and use it in GitHub Desktop.
#
# 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
@zamber
Copy link
Author

zamber commented Aug 17, 2014

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment