Interactive scripts (prompting for values)
EricGagne
Global Mapper UserTrusted User
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.
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.
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
-
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 -
Thanks Mike, I'm looking forward to trying this.
Eric -
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 -
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. -
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
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website