Name:gen-app-icons
Type:script
Source:gen-app-icons-lib.psm1
function getTaskDesc([Task]$task) {
[string]$desc = @"
This generates the app icons. The process starts GIMP and then the python-fu script runner
so there is radio silence for about 2 minutes depending on how many icons are generated.
"@
return $desc;
}
# ---------- define task parameters
function params([Object]$task,[hashtable]$htOpts) {
$parms = @{};
$parms.brief = "$($task.statlocn)"
$parms.str = "create Brief"
$parms.gen = "5"
$parms.genstr = "output line from parm definition line="
$parms.bool1 = $null
$parms['swkey='] = 'key-value';
return $parms
}
# ---------- the actual script
function runScript([Task]$task, [hashtable]$parms, [hashtable]$status) {
$tfs = $task.tfs;
$gfn = $tfs.globMap.gaelGlobs.gfn;
$locn = $task.execLocn
$libLocn = $task.libLocn
hlogBoth("Running gen-app-icons $($task.name) locn $locn")
$outStr = "locn=$locn`r`nlibLocn=$libLocn`r`ncurBase=$($gfn.curBase)`r`niconJson=$($gfn.iconJson)`r`ngaelProj=$($gfn.gaelProj)"
hlogBoth("Setup `r`n$outStr")
##return "$outStr `r`n==================================gimpStr===================`r`n we are done V3"
# See run-gen-icons.cmd" for a parameter explanation. Python, BTW, hates \ in paths it seems
$p1 = "$($gfn.curBase)" -replace '\\','/'
$cmd = "$($task.libLocn)/iconify-v4.ps1"
hlogBoth("cmd $cmd")
$creates = 0;
$logLines = "";
$outStr = (. $cmd "$p1" "$($gfn.iconJson)" "$($gfn.gaelProj)")
$outlines = $outStr -split "`r"
##forEach($line in $outLines) {
## $logLines += "$line `n"
##}
hlogBoth("Finished gen-app-icons $outLines")
$gimpStr = Get-Content -path "$($task.libLocn)/runlog.gimp.txt" -raw -encoding ascii
$gimpLines = $gimpStr -split "`n"
$warns = 0
$creates = 0
forEach($line in $gimpLines) {
if ($line -match "^created:.*/icons/(.*\.ico)") {
$creates += 1
#$status["icon$creates"] = "created $($matches[1])"
}
if ($line -match "^warning:") {$warns += 1}
if ($line -match "^GaelGenIcons finished") {
$status.sCondCode = "GOOD"
$status.remove('sReason')
}
}
if ($warns -gt 0) {$status.warnings = "There were $warns warnings issued"}
$status.ctlFile = "Input from:gen-icons-workorder.txt"
$status.creates = "There were $creates icons created"
return "$outStr `r`n==================================gimpStr===================`r`n $gimpStr"
}
Copyright © 2018-2021, 2022, Rexcel System Inc.