TPL converter script

Discussion in 'Wii - Hacking' started by CalebW, Jan 14, 2013.

Jan 14, 2013

TPL converter script by CalebW at 3:23 AM (1,161 Views / 0 Likes) 1 replies

  1. CalebW
    OP

    Member CalebW Fellow Temper

    Joined:
    Jun 29, 2012
    Messages:
    633
    Country:
    United States
    I'm tired of converting .tpls manually one by one so I decided to try to create a bash script(I use Linux not windows) that uses TPL.exe and would convert all .tpls to .png in the folder and vise versa. The script for tpl to png is:

    #!/bin/sh
    # converts .tpl images to .png

    for i in *.tpl; do
    if [ -e "$i" ]; then
    file=`basename "$i" .tpl`
    ./TPL.exe "$i" "$file.png"
    fi

    done

    and to convert png to tpl you just replace each file type with its counterpart (tpl changes to png and png changes to tpl) so the script would be:

    #!/bin/sh
    # converts .png images to .tpl

    for i in *.png; do
    if [ -e "$i" ]; then
    file=`basename "$i" .png`
    ./TPL.exe "$i" "$file.tpl"
    fi

    done
     
  2. Wiimm

    Member Wiimm Developer

    Joined:
    Aug 11, 2009
    Messages:
    2,052
    Location:
    Germany
    Country:
    Germany
    First, you can write this code smaller:
    Code:
    for i in *.tpl; do
      [ -e "$i" ] && ./TPL.exe "$i" "${i%.tpl}.png"
    done
    
    and if using my szs tools the code becomes smaller again:
    Code:
    wimgt copy *.tpl %N.png
    
     

Share This Page