GRLevelX WinBatch Automation Library & Script Processor

by WD5EAE

This library was written using WinBatch. WinBatch does Windows automation very well.

The purpose of this Library and the Script Processor is to automate the GRLevelX software. Not only can the GRLevelX software be automated, but also its functionality extended. For example,

  1. You want an audible alarm to sound when a particular state/county come under warning.
  2. You have a bunch of data you want GRLevelX to crunch through, and automating parts, or even all of the process will save you time.
  3. You want to create some preset views so that calling up the same position / zoom level is "automatic".
  4. You might be out in the field chasing storms while your computer at home, using broadband Internet, crunches the data and presents the resulting images on a lower bandwidth web page for your on-the-road consumption.
  5. You want to provide some customized weather graphics on your web site that are produced on a scheduled or repeating basis.
  6. You want to use GRLevel2 or GR2Analyst to produce images and then FTP upload them all on a scheduled or repeating basis.
  7. You have an idea for a function that the GRLevelX software doesn't currently have. Within some real limits, you might be able to code it, or script it, using this library.

The library was originally designed to control the GRLevel2 application. GRLevel3 and GR2Analyst are now supported as well. Within the source code you will find comments above some of the version dependent functions such as:

; Supported: GRLevel2, GRLevel3, GR2Analyst

This note indicates that the function has been tested across all three applications. Some functions only apply to GR2Analyst or GRLevel3 and are so noted.

A very simple script processor is now included in the source code as well as in a compiled EXE that's included in the zip file. Using the script processor you can write a simple text script to control the GRLevelX software.

The current version also includes the ability to incorporate a Script Menu into the GRLevelX software so that calling your custom scripts directly is easy to do:

Script Menu

 

Please send feature requests or code changes you make to my amateur radio address @arrl.net

Download the complete source-code and Script Processor GRLevelX Automation library

 

The Camtasia Studio video content presented here requires a more recent version of the Adobe Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 

 

Sample Library Calls

Note: If you use the library directly by programming in WinBatch you have 
a lot more flexibility that the Script Processor provides. The Script
Processor is currently very simple and will only process statements
unconditionally. There are no "if xyz() then ..." statements with the 
Script Processor. Therefore any test functions like IsOnline() or 
IsDownloading() are not available through the Script Processor. You 
can do a lot through the Script Processor, just not everything.

;*****************************************************************
; Special Function Examples
;*****************************************************************
IsOnline()
IsDownloading()
IsWaitingForNextDownload()
CenterImage(32.590843, -95.204697)
PanImage (-100, 0)              
if WarningsWindowExists() then
  GetWarningWindowInfo()
  if WarningExistsForStateCounty ("SVR", "GA", "Baker", @TRUE) then
    ConfigurePollingInterval (60)
    StartPolling()
  else
    ConfigurePollingInterval(600)
    SiteSelect("KSHV") 
    StartPolling()
  endif
endif    

GotoGRL3ProductTab("VIL")         
strWinLatLonBox = GetWindowLatLong()
;*****************************************************************
; File Menu Examples
;*****************************************************************
GRFileOpen("C:\Program Files\GRLevelX\GRLevel2\ktlx20030510_035421.z")
StartPolling()
StopPolling()
ConfigurePollingInterval (1209)
ConfigureRetainFilesFor (2)
ConfigureKeepVolumesInMemory (17)
ConfigurePolling (60*5, 2, 16)
SaveImage(1, "D:\web\htdocs\4x4kw\sshot1.png", @TRUE)
SaveImage(2, "D:\web\htdocs\4x4kw\sshot2.png", @TRUE)
SaveImage(3, "D:\web\htdocs\4x4kw\sshot3.png", @TRUE)
SaveImage(4, "D:\web\htdocs\4x4kw\sshot4.png", @TRUE)
GPSStart("COM3")
GPSStop()
;*****************************************************************
; View Menu Examples
;*****************************************************************
ZoomIn()
ZoomOut()
ZoomNone()
ZoomMode()
PanMode()
CrossSectionMode()
SetStormMotion(3, 10)
SetColorTable("C:\Program Files\GRLevelX\GRLevel2\default_reflectivity.pal")
SetColorTable("C:\Program Files\GRLevelX\GRLevel2\default_stormrelative.pal")
;*****************************************************************
; Site Menu Examples
;*****************************************************************
SiteSelect("KSHV") 

or
if SiteSelect("KSHV") then
endif
;*****************************************************************
; Derived Menu Examples
;*****************************************************************
; no code for this yet
;*****************************************************************
; GIS Menu Examples
;*****************************************************************
GISLoadShapeFile (fullpath to shapefile, full path to style file)
GISUnloadShapeFile ("C:\Program Files\GRLevelX\GRLevel2\countyp020.shp") OR
GISUnloadShapeFile ("countyp020.shp")
if IsMenuItemChecked ("&GIS", "Show Base &Roads") then
  Message("State", "Checked") 
else 
  Message("State", "Unchecked")
endif
SetMenuItemChecked ("&GIS", "Show Base &Roads", @TRUE)
;*****************************************************************
; Windows Menu Examples
;*****************************************************************
TurnWarningsWindowOn()
TurnWarningsWindowOff()
;*****************************************************************
; Information Window (Panel) Examples
;*****************************************************************
GetProduct() return 1-4 for GRLevel2, or 1-15 for GR2Analyst
SetProduct(1) Radio button 1-4 for GRLevel2, or 1-15 for GR2Analyst
SetTilt("1")   ; No decimal means button number 1-11
SetTilt("3.4") ; Decimal value means activate first button containing "3.4°"; Do not include '°'

if IsWarningFlashFloodActive() then
endif
SetWarningFlashFlood (@TRUE)              
SetDealias(@TRUE)
SetSmoothing(@TRUE)