Global Mapper Pro

Script not running through

EricGagne
EricGagne Global Mapper UserTrusted User
edited July 2012 in GM Script Language
Hello Mike,

I'm trying to make a script that would iterate 16 times through a bunch of folder/files. I will skip the details unless you need it later because it would make a very long post.

Since we can't iterate withing a script using a counter, I decided to create one sub-script which I call 16 times from my main script after setting a value for a variable.

Main script
GLOBAL_MAPPER_SCRIPT VERSION=1.00



DEFINE_VAR NAME="iPath"		VALUE="\\Bureau\Data\Geomatique\Cartes\Canvec" PROMPT=NO PROMPT_TEXT="Source Path"
DEFINE_VAR NAME="lPath"		VALUE="\\Bureau\Data\Geomatique\Cartes\Geobase\Elevation\50K" PROMPT=NO PROMPT_TEXT="Source Path"
DEFINE_VAR NAME="Zone"    	VALUE="031" PROMPT=YES PROMPT_TEXT="Zone Number:"
DEFINE_VAR NAME="Section"	VALUE="E" PROMPT=YES PROMPT_TEXT="Section"
DEFINE_VAR NAME="ePath"		VALUE="\\Bureau\Data\Geomatique\Projets Global Mapper" PROMPT=YES PROMPT_TEXT="Export Path"
DEFINE_VAR NAME="Projet"	VALUE="Trans-Taiga 2012" PROMPT=YES PROMPT_TEXT="Projet"


DEFINE_VAR NAME="Counter" VALUE="01"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="02"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="03"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="04"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="05"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="06"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="07"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="08"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="09"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="10"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="11"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="12"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="13"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="14"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="15"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


DEFINE_VAR NAME="Counter" VALUE="16"
EMBED_SCRIPT FILENAME="Generate Canvec Catalog Data Sub.gms"


Sub-script
UNLOAD_ALL
IMPORT_ARCHIVE ARCHIVE_FILENAME="%iPath%\%Zone%\%Section%\canvec_%Zone%%Section%%Counter%_shp.zip" FILENAME="*_TR_*.shp" TYPE=SHAPEFILE
EMBED_SCRIPT FILENAME="Set Types.gms"
EXPORT_PACKAGE FILENAME="%ePath%\%Projet%\TR\%Zone%%Section%%Counter%TR.gmp" VECTOR_ONLY=YES


UNLOAD_ALL
IMPORT_ARCHIVE ARCHIVE_FILENAME="%iPath%\%Zone%\%Section%\canvec_%Zone%%Section%%Counter%_shp.zip" FILENAME="*_TO_*.shp" TYPE=SHAPEFILE
EMBED_SCRIPT FILENAME="Set Types.gms"
EXPORT_PACKAGE FILENAME="%ePath%\%Projet%\TO\%Zone%%Section%%Counter%TO.gmp" VECTOR_ONLY=YES


UNLOAD_ALL
IMPORT_ARCHIVE ARCHIVE_FILENAME="%iPath%\%Zone%\%Section%\canvec_%Zone%%Section%%Counter%_shp.zip" FILENAME="*_VE_*.shp" TYPE=SHAPEFILE
EMBED_SCRIPT FILENAME="Set Types.gms"
EXPORT_PACKAGE FILENAME="%ePath%\%Projet%\VE\%Zone%%Section%%Counter%VE.gmp" VECTOR_ONLY=YES


UNLOAD_ALL
IMPORT_ARCHIVE ARCHIVE_FILENAME="%iPath%\%Zone%\%Section%\canvec_%Zone%%Section%%Counter%_shp.zip" FILENAME="*_SS_*.shp" TYPE=SHAPEFILE
EMBED_SCRIPT FILENAME="Set Types.gms"
EXPORT_PACKAGE FILENAME="%ePath%\%Projet%\SS\%Zone%%Section%%Counter%SS.gmp" VECTOR_ONLY=YES


UNLOAD_ALL
IMPORT_ARCHIVE ARCHIVE_FILENAME="%iPath%\%Zone%\%Section%\canvec_%Zone%%Section%%Counter%_shp.zip" FILENAME="*_HD_*.shp" TYPE=SHAPEFILE
EMBED_SCRIPT FILENAME="Set Types.gms"
EXPORT_PACKAGE FILENAME="%ePath%\%Projet%\HD\%Zone%%Section%%Counter%HD.gmp" VECTOR_ONLY=YES




UNLOAD_ALL
IMPORT_DIR_TREE DIRECTORY="%lPath%\%Zone%\" FILENAME_MASKS="%Zone%%Section%%Counter%*.zip"
GENERATE_CONTOURS
EXPORT_PACKAGE FILENAME="%ePath%\%Projet%\RE\%Zone%%Section%%Counter%RE.gmp" VECTOR_ONLY=YES



I took a chance that the sub-script would inherit the variables from the calling script and it looks like it's working. The problem is that the main script doesn't run through, it stops after executing my sub-script for %Counter% = 01.

Do you know why it wouldn't continue ? I'm not getting any errors in the log, it just stops running.

Comments

  • global_mapper
    global_mapper Administrator
    edited July 2012
    What version are you using? If you use SET_LOG_FILE at the start of the scripts to set log files to run, what are those outputting? This should help debug where it's failing out.

    Your embedded subscript is also missing the header line (GLOBAL_MAPPER_SCRIPT VERSION=1.00), but I'm not sure if that was just for pasting here or something that's actually missing.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • EricGagne
    EricGagne Global Mapper User Trusted User
    edited July 2012
    The header was missing in the subscript. That fixed the problem.


    Thx
Sign In or Register to comment.