none
Adding options with user input (HTA) RRS feed

  • Question

  • Hello,

    I have a basic code to take user input of variables that are passed to a batch script for running like the following:

    Sub gmtRun
    'define the region of interest -Rwest/east/south/north
        west = inputbox("West: ","Western limit")
        east = inputbox ("East: ","Eastern limit")
        south = inputbox ("South: ","Southern limit")
        north = inputbox ("North: ","Northern limit")
    'Define the SI values for land and seafloor density for Bouguer correction
        land_density = inputbox ("Land density: ","Crustal density (Land) kg m-3")
        seafloor_density = inputbox ("Seafloor density: ","Seafloor density kg m-3")
    'Specify the Long wavelength filter (km) for Bouguer residual and short wavelength filter (to clean noise)
        LW_filter = inputbox ("Long wavelength filter (km): ","Long wavelength filter (e.g. 250 km)")
        SW_filter = inputbox ("Short wavelength filter (km): ","Short wavelength filter (e.g. 25 km)")
    'Create a default prefix to all generated files    
        prefix = inputbox ("Filename prefix (e.g. NATL etc.): ","Filename prefix (area or project code)")

    'Run the primary GMT processing script (batch file) passing the variables input via VBS
        Set WshShell = CreateObject("WScript.Shell")
        WshShell.Run "GMTprocess.bat " & west & " " & east & " " & south & " " & north & " " _
        & land_density & " " & seafloor_density & " " _
        & LW_filter & " " & SW_filter & " " _
        & prefix, 0, True
    ' ...prefix, 1, True (cmd window opens and runs until finish), ...prefix, 0, True (cmd window run hidden)
        set WshShell = nothing
        self.close
    End Sub

    This all works fine and does the job needed. However, if the user types a wrong value or wants to go back and change something, there is no easy way to get out apart from clicking through all the entries to exit. So for example, is there a simple way to add a check option or go back to the start to correct things?

    Thanks for any pointers

    Lester

    Wednesday, August 26, 2015 7:46 AM

Answers

  • A HTA ("HTML application") is a HTML file that runs in local security.

    The basic idea is you design a web page with the .HTA extension, and it can use local code objects like the WshShell object (which you are using in your script above) and the FileSystemObject object.

    So yes, you can design an HTML form that contains the input boxes that you want, with a "submit" button that runs your executable with specific parameters.

    But no, we're not going to write it for you. That's not the purpose of this forum. There are probably plenty of examples of HTAs if you search.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, August 26, 2015 2:08 PM
    Moderator

All replies

  • A HTA ("HTML application") is a HTML file that runs in local security.

    The basic idea is you design a web page with the .HTA extension, and it can use local code objects like the WshShell object (which you are using in your script above) and the FileSystemObject object.

    So yes, you can design an HTML form that contains the input boxes that you want, with a "submit" button that runs your executable with specific parameters.

    But no, we're not going to write it for you. That's not the purpose of this forum. There are probably plenty of examples of HTAs if you search.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, August 26, 2015 2:08 PM
    Moderator
  • Wednesday, August 26, 2015 3:05 PM