Global Mapper v25.0

Ask user for folder?

fvidania
fvidania Global Mapper UserTrusted User
edited January 2015 in GM Script Language
Hi,
I'm creating a script to import all the csv and dxf from a folder. But I want the user to select the folder to import. Is that possible?

In other words, is it possible to "ask questions" to the user? or the script just run what's in the code without questions?

Thanks

Comments

  • tjhb
    tjhb Global Mapper User Trusted User
    edited January 2015
    You can use the DEFINE_VAR command with PROMPT=DIR.

    (There is an example in the entry mentioned. I can't give my own example because I haven't used this function myself yet.)
  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User
    edited January 2015
    Hello fdivania,

    As tjhb says, the DEFINE_VAR script command sounds like what you're looking for. You use DEFINE_VAR to define variables that can be used in the current script, and DEFINE_VAR with the PROMPT=DIR parameter allows the user to select a folder, which is captured in the variable you're defining. You can then use that variable in subsequent commands in your script.

    best regards,

    ~Jeff
  • fvidania
    fvidania Global Mapper User Trusted User
    edited January 2015
    Thank you to both of you. That's what I was looking for. For some reason in the link I'm using as guide, it doesn't show that option. It might be an old link or something.

    Global Mapper Scripting Reference

    Thanks,
  • JeffH@BMG
    JeffH@BMG Global Mapper Developer Trusted User
    edited January 2015
    Yep, that's the guide for Global Mapper v13. A bit dated (not sure what you're running). Evidently the prompt stuff came in later.

    Cheers,

    ~Jeff