Interactive scripts (prompting for values)

EricGagneEricGagne Global Mapper UserPosts: 129Trusted User
edited October 2011 in Suggestion Box
Hi,

The idea is to be prompted for values to be able to run scripts multiple times in the GUI with different values without having to modify/save/reload the script every time. This could be done by adding a "PROMPT" parameter to the DEFINE_VAR command.
GLOBAL_MAPPER_SCRIPT VERSION=1.00

DEFINE_VAR NAME="VAR_1" VALUE="XXX" PROMPT
DEFINE_VAR NAME="VAR_2" VALUE="YYY" PROMPT
DEFINE_VAR NAME="VAR_3" VALUE="ZZZ"

When running the script in background mode it would take the default values (XXX, YYY and ZZZ) but running from the GUI would pop-up a window and prompt for VAR_1 and VAR_2 values. VAR_3 in this case would not be prompted because it's not defined as a "PROMPT" variable.

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited October 2011
    That is a good idea and should be add-able without too much trouble. I'll let you know when I have a new build with this implemented.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • EricGagneEricGagne Global Mapper User Posts: 129Trusted User
    edited October 2011
    Thanks Mike, I'm looking forward to trying this.

    Eric
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited October 2011
    Eric,

    I have completed adding it, pretty cool feature. Add PROMPT=YES to enable prompting and you can even add a PROMPT_TEXT parameter with the text to prompt the user with if you don't want the default. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the change for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .


    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • EricGagneEricGagne Global Mapper User Posts: 129Trusted User
    edited October 2011
    Impressive Mike, you're fast. I'll try it later this morning and and give you my feedback.

    Big thanks, I didn't expect it so fast.
  • EricGagneEricGagne Global Mapper User Posts: 129Trusted User
    edited October 2011
    This is fantastic.

    My vector topo maps are stored by zone/sub-zone/section. That gives me 9 zone folders for the province of Quebec, each containing 16 sub-zones (a to p) and each containing 16 sections (1 to 16). That's a total of 2304 .zip files and each one contains more than 20 shapefiles for different things (roads, lakes, buildings etc).

    By combining the new "PROMPT=YES" with the support for wildcards you added last week I can import any segment I want from any zone/sub-zone very quickly and easily. Before I would have had to load all the zip files and then manually go close the layers I don't want.

    The task of loading a specific segment from 4 sections just went from about 1 hour to 3 minutes.
    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    
    DEFINE_VAR NAME="ZONE"    	VALUE="031" PROMPT=YES PROMPT_TEXT="Zone Number:"
    DEFINE_VAR NAME="SECTION" 	VALUE="A"   PROMPT=YES PROMPT_TEXT="Section Number:"
    DEFINE_VAR NAME="SEGMENT_TYPE" 	VALUE="TR"
    
    DIR_LOOP_START DIRECTORY="C:\Users\Eric Gagne\Documents\Mapping\Maps\Canvec\%ZONE%\%SECTION%\" FILENAME_MASKS="*.ZIP" RECURSE_DIR=YES
    	IMPORT_ARCHIVE ARCHIVE_FILENAME="%FNAME_W_DIR%" FILENAME="*%SEGMENT_TYPE%*" PROMPT_IF_TYPE_UNKNOWN=NO
    DIR_LOOP_END
    
    
Sign In or Register to comment.