..ok. Back at it
I don't like the current CSS as is in the help site. So, I made a "SciTE4AutoIt3 to CSS" script that outputs a nicer "color list" ( to give it a name, not an HTML guy )
#NoTrayIcon
#include <StringConstants.au3>
#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $g_SciTE_hDirector = 0, $g_idMemo = 0, $g_hGUI = 0
If Not StringInStr($CmdLineRaw, "/ErrorStdOut") Or @Compiled Then
Exit MsgBox($MB_TOPMOST, @ScriptName, "Run as script from SciTE4AutoIt3", 60)
EndIf
Exit main()
Func main()
Local $iW = 700, $iH = 350, $iErr, $sError = ""
$g_hGUI = GUICreate(StringTrimRight(@ScriptName, 4), $iW, $iH)
$g_idMemo = GUICtrlCreateEdit("", 2, 2, $iW - 4, $iH - 4, $WS_VSCROLL)
GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)
Local $sFilename = _SciTE_ExportScriptToHTML(@ScriptFullPath, @TempDir & "\" & @ScriptName & ".htm")
$iErr = @error
Switch $iErr
Case 1
$sError = 'File not created'
Case 2
$sError = 'File did not rename back to original'
Case 3
$sError = 'AutoIt Script Editor (SciTE4AutoIt3) is not loaded'
EndSwitch
Local $sData = FileRead($sFilename)
FileDelete($sFilename)
Local $sChunk = "", $aChunks = StringSplit($sData, "><")
For $n = 1 To UBound($aChunks) - 1
If StringInStr($aChunks[$n], @CRLF & ".S") Then
$sChunk = $aChunks[$n] ; this is where the CSS is at
ExitLoop
EndIf
Next
$aChunks = StringSplit($sChunk, "}{")
Local $aCSS[UBound($aChunks) + 2][3]
$aCSS[0][0] = 0
For $n = 2 To UBound($aChunks) - 1 Step 2 ; turn the CSS into an array
$aChunks[$n] = StringStripWS(StringReplace($aChunks[$n], @CRLF, " "), 7)
If $aChunks[$n] = "" Then ContinueLoop
$aCSS[0][0] += 1
$aCSS[$aCSS[0][0]][0] = StringStripWS($aChunks[$n - 1], 8)
$aCSS[$aCSS[0][0]][1] = $aChunks[$n]
$aCSS[$aCSS[0][0]][2] = _SciTE_Colors_Description($aCSS[$aCSS[0][0]][0])
Next
ReDim $aCSS[$aCSS[0][0] + 1][3]
; this builds the CSS values for the script examples in the CHM/HTM file
Local $sCSS = '/*** SciTE colors ***/' & @CRLF
For $n = 1 To $aCSS[0][0]
Switch $aCSS[$n][0]
Case "span"
$sCSS &= '/* ' & $aCSS[$n][0] & " { " & $aCSS[$n][1] & " } " & $aCSS[$n][2] & " */" & @CRLF
Case Else
$sCSS &= $aCSS[$n][0] & " { " & _SciTE_Colors_RemoveFontSize($aCSS[$n][1]) & " } /* " & $aCSS[$n][2] & " */" & @CRLF
EndSwitch
Next
$sCSS &= '/*** SciTE colors ***/' & @CRLF
;~ ConsoleWrite($sCSS)
MemoWrite($sError = "" ? $sCSS : $sError)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
Return SetError($iErr, 0, $iErr)
EndFunc ;==>main
; Write message to memo
Func MemoWrite($sMessage = "", $iAppend = 1)
GUICtrlSetData($g_idMemo, $sMessage & @CRLF, $iAppend)
EndFunc ;==>MemoWrite
Func _SciTE_Colors_RemoveFontSize($sStr)
Local $n, $sReturn = "", $aArray = StringSplit($sStr, ";")
For $n = 1 To UBound($aArray) - 1
If StringStripWS($aArray[$n], 8) = "" Then ContinueLoop
If StringInStr($aArray[$n], "font-size") Then ContinueLoop
$sReturn &= $aArray[$n] & ";"
Next
Return $sReturn
EndFunc ;==>_SciTE_Colors_RemoveFontSize
Func _SciTE_Colors_Description($sS0)
Switch $sS0 ; /*** SciTE colors ***/ /** __SciTE4AutoIt3_Dark.SciTEConfig **/
Case ".S0"
Return "White space"
Case ".S1"
Return "Comment line"
Case ".S2"
Return "Comment block"
Case ".S3"
Return "Number"
Case ".S4"
Return "Function"
Case ".S5"
Return "Keyword"
Case ".S6"
Return "Macro"
Case ".S7"
Return "String"
Case ".S8"
Return "Operator"
Case ".S9"
Return "Variable"
Case ".S10"
Return "Send keys in string"
Case ".S11"
Return "Pre-Processor"
Case ".S12"
Return "Special"
Case ".S13"
Return "Abbrev-Expand"
Case ".S14"
Return "COM Objects"
Case ".S15"
Return "Standard UDF's"
EndSwitch
Return ""
EndFunc ;==>_SciTE_Colors_Description
; #FUNCTION# ====================================================================================================================
; @error:
; 1 = File not created
; 2 = File did not rename back to original
; 3 = SciTE is not loaded
;
; Example:
;~ MsgBox(0, @ScriptName, "File: " & _SciTE_ExportScriptToHTML(@ScriptFullPath, @ScriptFullPath & ".htm") & _
;~ @LF & @LF & 'Error: ' & @error & @LF & 'Extended: ' & @extended)
; ===============================================================================================================================
Func _SciTE_ExportScriptToHTML($sSource, $sDestination)
Local $iErr = 1, $iExt = 0, $sDestinationTemp = $sDestination & "~" & TimerInit() & ".htm"
If Not _SciTE_GetDirector(True) Then Return SetError(3, 0, "")
__SciTE_Send_Command(0, _SciTE_GetDirector(False), 'exportashtml:' & StringReplace($sDestinationTemp, '\', '\\'))
If FileGetSize($sDestinationTemp) Then
$iExt = Int(Not FileMove($sDestinationTemp, $sDestination, 9))
$iErr = ($iExt ? 2 : 0)
EndIf
Return SetError($iErr, $iExt, ($iErr ? $sDestinationTemp : $sDestination))
EndFunc ;==>_SciTE_ExportScriptToHTML
Func _SciTE_GetDirector($bIsReset = False)
Local Enum $SCITE_DIRECTOR = 1
If $bIsReset Or Not IsHWnd($g_SciTE_hDirector) Then
$g_SciTE_hDirector = WinGetHandle('DirectorExtension')
If @error Then $g_SciTE_hDirector = 0
EndIf
Return $g_SciTE_hDirector
EndFunc ;==>_SciTE_GetDirector
Func __SciTE_Send_Command($hWnd, $hSciTE, $sMsg)
Local $bReturn = False, $_WM_COPYDATA = 74, $tagCOPYDATASTRUCT = "ulong_ptr dwData;dword cbData;ptr lpData"
If Not (StringStripWS($sMsg, $STR_STRIPALL) == '') Then
$sMsg = ':' & Dec(StringTrimLeft($hWnd, StringLen('0x'))) & ':' & $sMsg
Local Const $tBuffer = DllStructCreate('char cdata[' & StringLen($sMsg) + 1 & ']')
DllStructSetData($tBuffer, 'cdata', $sMsg)
Local Const $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT)
DllStructSetData($tCOPYDATASTRUCT, 'dwData', 0)
DllStructSetData($tCOPYDATASTRUCT, 'cbData', DllStructGetSize($tBuffer))
DllStructSetData($tCOPYDATASTRUCT, 'lpData', DllStructGetPtr($tBuffer))
_SendMessage($hSciTE, _
$_WM_COPYDATA, _
$hWnd, _
DllStructGetPtr($tCOPYDATASTRUCT))
$bReturn = Not @error
EndIf
Return $bReturn
EndFunc ;==>__SciTE_Send_Command
#cs
Added for color export.
#ce
#pragma compile(LegalCopyright, © You) ; Added for color export.
Func ForColorExports()
Return "This is not meant to run. Added for color export."
; "cmd " ..typing that would expand to "RunWait('"' & @ComSpec & '" /c |', '', @SW_HIDE)"
; The .S13 ("Abbrev-Expand") will not be rendered in the code, thereby preventing the value from being exported.
; for more help go to https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/SciTE4AutoIt3-AbbreviationHowTo.html
Local $oShell = ObjCreate("shell.application") ; Get the Windows Shell Object
Local $oShellWindows = $oShell.Windows() ; Get the collection of open shell Windows
Send("{SPACE}")
EndFunc ;==>ForColorExports
/*** SciTE colors ***/
.S0 { color: #80C0FF; } /* White space */
.S1 { font-style: italic; color: #60A060; } /* Comment line */
.S2 { font-style: italic; color: #60A060; } /* Comment block */
.S3 { color: #C0FFFF; } /* Number */
.S4 { color: #8080FF; } /* Function */
.S5 { color: #C080C0; } /* Keyword */
.S6 { color: #A0A000; } /* Macro */
.S7 { color: #F0E090; } /* String */
.S8 { color: #FF8000; } /* Operator */
.S9 { color: #D0D0D0; } /* Variable */
.S10 { color: #A0A0A0; } /* Send keys in string */
.S11 { color: #8996A8; } /* Pre-Processor */
.S12 { color: #FFAAB7; } /* Special */
.S14 { color: #993399; } /* COM Objects */
.S15 { color: #0080FF; } /* Standard UDF's */
/* span { font-family: 'Courier New'; color: #D0D0D0; font-size: 10pt; } */
/*** SciTE colors ***/
that is easier to see and edit, and with some help for what applies to what. ( you could test online too )
I'll have my test site updated soon(done) to reflect what's in the works.
Given that the test site, is testing stuff, some times the prior CSS or JS may be used instead of the current.
To clear the cache data, open "inspect data", go to network and tick "Disable cache". Reload the page and that should be all that's needed.