WinBatch to HTML from Studio

Started by richardh, August 28, 2013, 01:35:44 PM

Previous topic - Next topic

richardh

It's nice that you provide the option on your website to convert source to html preserving color format on your website.

It would also be nice if you provided the same functionality as a 'save as' option for WinBatch Studio.

Deana

Are you looking to convert a colorized WinBatch script to an HTML? If so someone has already created that functionality, which can be added to the WinBatch Studio's right click context menu. 

Detlev's website has a wbt2html.wbt program that will color code turned into HTML for you.
http://winbatch.hpdd.de/MyWbtHelp/htm/20110327.WBT2HTML.v313.htm

Or here is a local copy with an install script that will add this script to the Winbatch Studio Right Click menu.
http://techsupt.winbatch.com/techsupt/WBT2HTML_3_13.zip
Deana F.
Technical Support
Wilson WindowWare Inc.

richardh

Have you tested either of these lately?

Deana

Looks like you will need to modify the udfGetPathToWilKeywords () function in WBT2HTML.313.wbt. This is because the WinBatch directory path that function is attempting to retrieve is stored (on 64-bit systems) under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Wilson WindowWare\WinBatch\CurrentVersion.

Code (winbatch) Select
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfGetPathToWilKeywords ()
strFileWilKeywords = "WIL.CLR" ; Default.
strRegKeySub = "Software\Wilson WindowWare\WinBatch Studio\Settings\File types\WIL Files"
If RegExistKey (@REGCURRENT, strRegKeySub)
   hdlRegKey = RegOpenKeyEx (@REGCURRENT, strRegKeySub, 1, "", 0) ; Mode=1=KEY_QUERY_VALUE=Permission to query subkey data ; We only need read access.
   strRegKeySub = "[Keywords]"
   If RegExistValue (hdlRegKey, strRegKeySub) Then strFileWilKeywords = RegQueryStr (hdlRegKey, strRegKeySub)
   RegCloseKey (hdlRegKey)
EndIf
If FilePath (strFileWilKeywords) != "" Then Return strFileWilKeywords ; Just for the case, if there is already a full filepath.
if WinMetrics(-2) == 2 then strRegKeySub = "SOFTWARE\Wow6432Node\Wilson WindowWare\WinBatch\CurrentVersion" ;32-bit winbatch ;DRF_20130828
else strRegKeySub = "SOFTWARE\Wow6432Node\Wilson WindowWare\WinBatch\CurrentVersion64" ;64-bit winbatch                      ;DRF_20130828
If RegExistKey (@REGMACHINE, strRegKeySub)
   hdlRegKey = RegOpenKeyEx (@REGMACHINE, strRegKeySub, 1, "", 0) ; Mode=1=KEY_QUERY_VALUE=Permission to query subkey data ; We only need read access.
   If RegExistValue (hdlRegKey, "") Then strDirHome = RegQueryStr (hdlRegKey, "")
   RegCloseKey (hdlRegKey)
EndIf
if !IsDefined(strDirHome) then strDirHome = DirHome()
strDirHome = strDirHome : StrSub ("\", StrSub (strDirHome, StrLen (strDirHome), 1) != "\", 1):'System\'  ; Check Backslash delimiter for sure.
Return strDirHome : strFileWilKeywords
;...
; This UDF "udfGetPathToWilKeywords" extracts from the registry the current filename of WinBatch Studio's keyword file for WIL files.
; The return value is the full filepath to the keyword file, usually it is the same as 'DirHome() : "WIL.CLR"'.
;
; (c)Detlev Dalitz.20110301.
; DRF_20130828  - Modified registry path to locate the WinBatch System Directory.
;...
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

You can even simplify it further using this code:

Code (winbatch) Select

;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfGetPathToWilKeywords ()
strFileWilKeywords = "WIL.CLR" ; Default.
strRegKeySub = "Software\Wilson WindowWare\WinBatch Studio\Settings\File types\WIL Files"
If RegExistKey (@REGCURRENT, strRegKeySub)
   hdlRegKey = RegOpenKeyEx (@REGCURRENT, strRegKeySub, 1, "", 0) ; Mode=1=KEY_QUERY_VALUE=Permission to query subkey data ; We only need read access.
   strRegKeySub = "[Keywords]"
   If RegExistValue (hdlRegKey, strRegKeySub) Then strFileWilKeywords = RegQueryStr (hdlRegKey, strRegKeySub)
   RegCloseKey (hdlRegKey)
EndIf
If FilePath(strFileWilKeywords) != "" Then Return strFileWilKeywords ; Just for the case, if there is already a full filepath.
strDirHome = FilePath(FileLocate('winbatch.exe'))
Return strDirHome : strFileWilKeywords
;...
; This UDF "udfGetPathToWilKeywords" extracts from the registry the current filename of WinBatch Studio's keyword file for WIL files.
; The return value is the full filepath to the keyword file, usually it is the same as 'FilePath(FileLocate('winbatch.exe')) : "WIL.CLR"'.
;
; (c)Detlev Dalitz.20110301.
; DRF_20130828  - Modified the method used to get the WinBatch System Directory.
;...
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

Deana F.
Technical Support
Wilson WindowWare Inc.

richardh

Deana,

The code works now.

Thanks,
R