Adding options with user input (HTA)

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

August 26th, 2015 3:57am

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.

Free Windows Admin Tool Kit Click here and download it now
August 26th, 2015 10:19am

HTAs are here: https://technet.microsoft.com/en-us/scriptcenter/dd742317

August 26th, 2015 11:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics