FILE_MUST_EXIST=NO promtps an open window and not a save window

Below is my script. When I execute this in GM it fails bc the FILE_MUST_EXIST=NO section of my export variable, in BOLD below, is prompting me with an "open" window and not a "save" window.  I am using GM version 16.1.2 on a windows 10 machine.


GLOBAL_MAPPER_SCRIPT VERSION=1.00

//define the directory and filename needed for conversion
DEFINE_VAR NAME="DIR_TO_LOAD" PROMPT="DIR" VALUE="A:\J18350-TGS-WestAfrica_Leg_2\Processing\Caris\Export\Completed_Lines\" \
ABORT_ON_CANCEL=NO

DEFINE_VAR NAME="FILE_TO_LOAD" PROMPT="FILE" VALUE="%DIR_TO_LOAD%.asc" \
ABORT_ON_CANCEL=YES

//define the directory and filename for exporting
DEFINE_VAR NAME="DIR_TO_EXPORT" PROMPT="DIR" VALUE="A:\J18350-TGS-WestAfrica_Leg_2\Client\Data\MBES_Processed\CarisGeocoder_Backscatter\" \
ABORT_ON_CANCEL=NO FILE_MUST_EXIST=NO

DEFINE_VAR NAME="FILE_TO_EXPORT" PROMPT="FILE" VALUE="%DIR_TO_EXPORT%.asc" \
ABORT_ON_CANCEL=YES FILE_MUST_EXIST=NO

//import ASCII data and ignore all values outside of the -5 to -65 range
IMPORT FILENAME="%FILE_TO_LOAD%" TYPE="ARCASCIIGRID" \
  TYPE="ARCASCIIGRID" LABEL_FIELD_FORCE_OVERWRITE="NO" CLIP_COLLAR="NONE" SAMPLING_METHOD="BILINEAR" \
  ELEV_UNITS="METERS" MIN_ELEV="-65.000000" MAX_ELEV="-5.0000000"

DEFINE_PROJ PROJ_NAME="UTM_ZONE28_WGS84"
Projection     UTM
Datum          WGS84
Zunits         NO
Units          METERS
Zone           28
Xshift         0.000000
Yshift         0.000000
Parameters
END_DEFINE_PROJ

// export the file as imported - ignoring the values less than -5 and greater than -65
EXPORT_ELEVATION FILENAME="%FILE_TO_EXPORT%" \
 TYPE=ARCASCIIGRID GEN_PRJ_FILE=YES

Answers

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,960
    Hello,

    I put your command into a script in Global Mapper 20, and the result is a prompt to save a file, as expected. It appears that if this was an issue in Global Mapper 16, it has since been fixed.

    Cheers,
    Bob
  • Bob,

       I was able to find a work around by using "YES" for the prompt instead of "FILE" within Global Mapper (GM). Taking this project a step further and running this via a .bat file, GM fails to execute this script as far as I can tell. The CMD window opens and all of the prompts are executed except the save value window where I would give the file its name. Again, both directory prompts and the file input prompt is executed but the "value" window where I would give the file its name never opens and no files a generated in either directories. Do you have any ideas why this would be happening?

        Cheers and thanks again,

                          Mike

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,960
    Hi Mike,

    When running from the command line, Global Mapper only displays prompts for PROMPT=FILE and PROMPT=DIR, or if PROMPT=YES and the VALUE is empty. Here is a workaround:
    DEFINE_VAR NAME="DEFAULT" VALUE="The default value" 
    DEFINE_VAR NAME="THEVAR" PROMPT=YES ABORT_ON_CANCEL=YES PROMPT_TEXT="Please enter a value (default is '%DEFAULT%')"
    IF COMPARE_STR="%THEVAR%="
    DEFINE_VAR NAME="THEVAR" VALUE="%DEFAULT%"
    END_IF
    Cheers,
    Bob

Sign In or Register to comment.