New line in prompt text

Ice Age MarkIce Age Mark Global Mapper UserPosts: 324Trusted User
Hello,

I want to have a short list instead of a long sentence for my "PROMPT_TEXT" text in DEFINE_VARIABLE.  I've tried every combination of escape/new line character (\'n') combinations I can think of (including using "\\"), but it doesn't seem to work.  Is this not possible with a prompt text window?  If it is, what is the correct way to script it?

Thanks for any insight,

Mark

Best Answer

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,146
    Answer ✓
    Hi Mark,

    What version of Global Mapper are you using? I am running Global Mapper v21.0.2 (b120219) (121) [64-bit] [+LIDAR] - REGISTERED, the latest daily build. I don't know exactly when we made the change to handle new line characters within a parameter value.

    The new line characters in my script are immediately after the last character in each line, but I am not sure it really matters. The warning shown on my output indicates that you should be able to use "\n" to represent a new line, but that didn't work. I will need to investigate further.

    Here is the output I got when I ran your script:



    Cheers,
    Bob

Answers

  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,146
    edited December 2019
    Hello Mark,

    The script parser can handle an actual new line character inside a parameter value, so you can do the following to put a list in your prompt:

    DEFINE_VAR NAME="THEVAR" PROMPT=YES ABORT_ON_CANCEL=YES PROMPT_TEXT="This is a list:
    ITEM1
    ITEM2
    ITEM3"
    I hope this helps.

    Cheers,
    Bob
  • Ice Age MarkIce Age Mark Global Mapper User Posts: 324Trusted User
    Hello there Bob,

    Thanks for the quick reply, but when my script has:

    DEFINE_VAR NAME="SECTOR" VALUE="" PROMPT="YES" PROMPT_TEXT="Choose a region:
    (1) E. Washington
    (2) Pacific Northwest
    (3) West Coast
    (4) East Pacific"

    My prompt text window says:

    "Enter value for script variable SECTOR:"

    That makes sense because there is no continuation character (\) after "region:" to finish that command.  Could you be more explicit about exactly what to use. Where does the new line character go, and what is it's correct form?  I want my prompt text window to look like this:

    Choose a region:
    (1) E. Washington
    (2) Pacific Northwest
    (3) West Coast
    (4) East Pacific

    Thanks again,

    Mark

  • Ice Age MarkIce Age Mark Global Mapper User Posts: 324Trusted User
    Howdy,

    That's what I want and what I'm doing, but I'm on Version 17.2, so maybe it wasn't implemented yet.  Let me know what you find out.

    Thanks for looking into it,

    Mark
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 2,146
    Hello,

    The behavior I am seeing is actually a side-effect of Global Mapper searching for the ending quote in a quoted string when it extends beyond the end of a line. It is limited to 5 lines. This behavior was added pretty recently, during development of Global Mapper 21. I have added a new item to our task list to do something more intentional with respect to supporting a new line in the prompt text. This is issue GM-10513.

    Cheers,
    Bob
  • Ice Age MarkIce Age Mark Global Mapper User Posts: 324Trusted User
    Well darn, I guess I'll have to use abbreviations.  Thanks very much for taking a look, Bob.

    Best regards,

    Mark
Sign In or Register to comment.