New to loop script

mangremangre Global Mapper UserPosts: 7
I have a large number of export raster .gms scripts in a folder.

Would anyone have a loop script that could run these sets of .gms scripts, and save the results to the same folder.

Thanks
Paul

Best Answer

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,686
    Answer ✓
    Hello,

    You can use the DIR_LOOP_START command to loop through your script files, and the EMBED_SCRIPT command to run the scripts.

    Cheers,
    Bob

Answers

  • mangremangre Global Mapper User Posts: 7
    Hi Bob,
    That did what I have been trying to achieve.for so long. The scripts from 1 through to 15 which are Export Raster scripts. are now looping.. thanks.

    The only problem I have is once I get to 15, it re starts the loop again at 1 through to 15 again.

    Any suggestions, I have attached my script.

    Cheers
    Paul.

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    DIR_LOOP_START DIRECTORY="C:\Users\paul\AA GLOBAL MAPPER SCRIPTS\A WATER_COLOR SCRIPT\"
    EMBED_SCRIPT FILENAME="FILE 1.GMS"
    EMBED_SCRIPT FILENAME="FILE 2.GMS"
    EMBED_SCRIPT FILENAME="FILE 3.GMS"
    EMBED_SCRIPT FILENAME="FILE 4.GMS"
    EMBED_SCRIPT FILENAME="FILE 5.GMS"
    EMBED_SCRIPT FILENAME="FILE 6.GMS"
    EMBED_SCRIPT FILENAME="FILE 7.GMS"
    EMBED_SCRIPT FILENAME="FILE 8.GMS"
    EMBED_SCRIPT FILENAME="FILE 9.GMS"
    EMBED_SCRIPT FILENAME="FILE 10.GMS"
    EMBED_SCRIPT FILENAME="FILE 11.GMS"
    EMBED_SCRIPT FILENAME="FILE 12.GMS"
    EMBED_SCRIPT FILENAME="FILE 13.GMS"
    EMBED_SCRIPT FILENAME="FILE 14.GMS"
    EMBED_SCRIPT FILENAME="FILE 15.GMS"
    DIR_LOOP_END 


  • mangremangre Global Mapper User Posts: 7
    I should of placed unload all.

    Working perfect...
    Thanks
    Paul
  • mangremangre Global Mapper User Posts: 7
    Hi Bob,
    I have created a  .gmw script that opens my saved  .gmw  Map ,and then within this script a DIR_LOOP_START DIRECTORY through the scripts EMBED_SCRIPT FILENAME="FILE 9.GMS" as shown in my previous post.
    This works well.
    But if I I create a task with triggers in windows task scheduler to start at a specific time. it will not work at all

    I then created .bat file to open the .gmw script  and run, I tested this and worked fine, I passed this to windows task scheduler to test.  This did  open the save script and opened .gmw map, but will not  start the  DIR_LOOP_START DIRECTORY  command to run the EMBED_SCRIPT FILENAME to complete the full script.

    This has me scratching my head as it works fine otherwise.

    Any help here would be appreciated.

    Cheers
    Paul




Sign In or Register to comment.