GRLevelX WinBatch Automation Library & Script Processorby 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,
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:
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
|
Sample Library CallsNote: 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) |