Jump to content

AutoItHelp v3.3.16.1 and v3.3.18.0 with external CSS loading


Go to solution Solved by argumentum,

Recommended Posts

Posted
57 minutes ago, SOLVE-SMART said:

(if I had access to the sources).

5 hours ago, argumentum said:

The files to make the CHM/HTMs are there for download

🤔

59 minutes ago, SOLVE-SMART said:

It's unfortunate to use several css classes to apply a AutoIt code syntax highlighting when we have services that allow the visualization (syntax highlighting) for different languages more or less out-of-the-box. prismjs.com or highlightjs.org to name two of several.

The web site and the CHM is the same as far as the HTM files.

I just wanted dark mode for my dark life. Like bat-man in the bat-cave ( need a sad back story, but I'll think of something... ).  
Anywayz, ..do it. Just do it. A proof of concept. In the downloads there are other stuff I used for testing CHM stuff.
Put your code where your adventurous speech is at ( a funny way to be rude to you, but am bat-man :P ).

@WildByDesign 's idea is good, I think. Yours is good too ... 🤔

If is better..., I'll do a JPM approach: show me what you've got. 

P,S.: Most everything on this site: UDFs, help file, etc. ( I used "etc." but that is about everything there is ) was/is made by users like you. :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)
14 hours ago, argumentum said:

Anywayz, ..do it. Just do it. A proof of concept. In the downloads there are other stuff I used for testing CHM stuff.

Hi bat-man, I mean @argumentum 😅 ,

I would start with a PoC, yes. But I need the sources which are used to create the current HTML and CSS structure. My assumption was, it's stored in the AutoIt SVN where I don't have access to. I don't want to go the way around and parse the current HTML documentation site by site and recreate the docu.

Did I maybe miss something that I have to consider? I didn't read the all thread posts ... .
Thanks for a possible enlightening 😁 .

Best regards
Sven

Update:
Q: Did I maybe miss something that I have to consider?
A: Yes 😅 , I missed the fact that you already linked the docs source.

Sorry, I will have a look later today.

Edited by SOLVE-SMART

==> AutoIt related: 🔗 Organization AutoIt Community🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet🔗 autoit-webdriver-boilerplate

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted
1 minute ago, bladem2003 said:

With the help of FAR HTML, I created an AutoIt help file with index and search functionality.

Incredible! Nice work. I quite often use the help files, almost daily. So having this available locally and in such a beautiful theme, this is perfect.

Posted
12 minutes ago, bladem2003 said:

With the help of FAR HTML, I created an AutoIt help file with index and search functionality.

"FAR HTML is a free Windows application. A collection of help authoring and file utilities."

Ok, free is good.
Given that the software is free, I think that attempting an integration that generates this ( help file with index and search ) in the workflow of the AutoIt help file ( and web site ) will not be limited by licensing concerns.
So, the web site wouldn't need much convincing to the higher ups ( you know who you are ).

Now, CHM vs WebView2. CHM can run anywhere, WebView2 not so sure. ( I'd love to have a fully functional help file in WinPE 😍 )
Then we will have to come up with a AutoIt3Help.exe to work with the WebView2 version in local PCs.

I guess that if we make an AutoIt3Help.exe script ( by we I mean you all ), am sure that it can be translated to C and have the alternate ( for now ) "local web help".

Again, this forum brought about everything around and in the AutoIt distribution.
So it'd be up to us forum members, to change the ways things are, that as always, change bring about some degree of resistance 🤷‍♂️

This is me thinking out loud. As always, "put your code where your mouth is"(tm) :P 

 @bladem2003, nice going. Thanks :) 

P.S.: Everything that builds the help file and web site, needs to run from a command line.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

..and:
image.png.d1a1d86f5a189e08dfadb55bc91e38fd.png

"Click for more help" links to "https://kb.helpwaregroup.com/far/webhelp/search-help" that don't exist.
Given that this is close to abandonware ( last update in 2019 ), the generated files will have to be patched for coherent functionality.
We are responsible of whatever we host and can not claim that is not our fault because we are in the software business ourselves  😲 :lol:

Edited by argumentum
English

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
31 minutes ago, argumentum said:

..and:
image.png.d1a1d86f5a189e08dfadb55bc91e38fd.png

"Click for more help" links to "https://kb.helpwaregroup.com/far/webhelp/search-help" that don't exist.
Given that this is close to abandonware ( last update in 2019 ), the generated files will have to be patched for coherent functionality.
We are responsible of whatever we host and can not claim that is not our fault because we are in the software business ourselves  😲 :lol:

Yes I know I have already patched some files to make the dark theme.

Posted

..did some patching too
 

Spoiler
<!DOCTYPE html>
<!-- !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" -->

<!-- 
//*==============================================================================  
//*    ** DO NOT REMOVE OR MODIFY THIS COPYRIGHT MESSAGE **                        
//*                                                                                
//*    Document generated by FAR HTML 5 
//*    Copyright (c) 2004-2016 The Helpware Group
//*    http://helpwaregroup.com/
//*    WARNING: You must purchase a copy of FAR HTML v5 or greater to publish this file.
//*
//*==============================================================================


  changes by argumentum on 2026.02.13 ( not a credit line, just a note to know who did what when )

-->
<html>
<head>
  
<!-- add extra header code to main frame here -->  
<link rel="icon" href="favicon.ico?v=2" type="image/x-icon" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 


<script src="hw_library.js" type="text/javascript"></script>
<script type="text/javascript">
  <!--
  function DebugOut(s) 
  {
    var debugDiv = document.getElementById("debugDiv");
    if ((debugDiv != null) && (debugDiv != undefined))
      debugDiv.innerHTML = s;
  }
 
  function ResizeDivs() 
  {
    //resize main pane vertically
    var hh = GetDocHeight();
    if (debugDiv !== null && debugDiv !== undefined)
      hh = hh - debugDiv.clientHeight;
    if (bannerDiv !== null && bannerDiv !== undefined)
      hh = hh - bannerDiv.clientHeight;
    if (topSpacerDiv !== null && topSpacerDiv !== undefined)  
      hh = hh - topSpacerDiv.clientHeight;
    mainDiv.style.height = hh + "px";

    //resize rightDiv to fill content space horizontally
    var ww = GetDocWidth() - leftDiv.clientWidth - splitterDiv.clientWidth;
    if (ww > 0) {
    
      // 2017/07/25 Fix for Chrome: If browser Zoom <> 100% and right frameDiv too wide we may lose right pane visibility. Shaving a pixel off. 
      if (window.devicePixelRatio) //defined
      {
        var isZoomed = Math.round(window.devicePixelRatio * 100);
        if ((isZoomed !== 100) && (isZoomed < 200) && (ww > 1))
          ww = ww-1;         
      }    
    
      rightDiv.style.width = ww + "px";
    }
  }
  
  //== Start Splitter Code ============================================================================

  var spitterActive=false;
  var SPLITTER_MAX = 500;
  var SPLITTER_MIN = 10;
  var saveSplitterColor = "";
  
  function InitSplitter() {
    splitterDiv.onmousedown = SplitterMouseDownEvent;
    document.onmouseup = SplitterMouseUpEvent;
    document.onmousemove = SplitterMouseMoveEvent;
  }
  
  function SplitterMouseDownEvent() {
    spitterActive = true;
    leftFrame.style.visibility = "hidden";
    rightFrame.style.visibility = "hidden";
    saveSplitterColor = splitterDiv.style.backgroundColor;
    splitterDiv.style.backgroundColor = "#e2e2e2"; //make splitter visible
  }
  function SplitterMouseUpEvent() {
    if (spitterActive) {
      spitterActive = false;
      leftFrame.style.visibility = "visible";
      rightFrame.style.visibility = "visible";
      splitterDiv.style.backgroundColor = saveSplitterColor;  //respore original color
    }
  }
  function SplitterMouseMoveEvent(event) {
    if (spitterActive) {
      event = event || window.event;
      var midPoint = leftDiv.clientWidth + (splitterDiv.clientWidth / 2);
      var xDiff = midPoint - event.clientX;
      var newPos = leftDiv.clientWidth - xDiff;
      if (xDiff !== 0 && newPos < SPLITTER_MAX && newPos > SPLITTER_MIN) {          
        leftDiv.style.width = newPos + "px";
        ResizeDivs();
      }
    }
  }
  

  //== End Splitter Code ============================================================================

  var leftDiv;
  var rightDiv;
  var splitterDiv;
  var leftFrame;
  var rightFrame;
  var topFrame;

  var debugDiv;
  var bannerDiv;
  var mainDiv;
  var topSpacerDiv;
  
  function InitializeDocCode() 
  {
    leftDiv = document.getElementById("leftDiv");
    rightDiv = document.getElementById("rightDiv");
    splitterDiv = document.getElementById("splitterDiv");
    leftFrame = document.getElementById("leftFrame");
    rightFrame = document.getElementById("rightFrame");
    topFrame = document.getElementById("topFrame");
  
    debugDiv = document.getElementById("debugDiv");
    bannerDiv = document.getElementById("bannerDiv");
    mainDiv = document.getElementById("mainDiv");
    topSpacerDiv = document.getElementById("topSpacerDiv");    
    
    //validation check vars
    if ((!leftDiv || !rightDiv || !splitterDiv || !bannerDiv || !mainDiv || !debugDiv)
    || (!leftFrame || !rightFrame || !topFrame || !topSpacerDiv))
      alert("code error 101: uninitialized vars");
      
    //to enable debug pane comment out next 2 lines
    debugDiv.style.height = 0 + "px";
    debugDiv.style.visibility = "hidden";
  }

  function OnLoadEvent() {
    window.onresize=ResizeDivs;
    ResizeDivs();
    InitSplitter();
  }  
  
  function GetThisFName() {
    path = location.pathname;  // "http://c:/base/start.htm" --> "base/start.htm"
    var fname = path.substr(path.lastIndexOf("/") + 1, path.length);   // "base/start.htm" --> "start.htm"
    return(fname);
  }

  var lastClickCount = 0;
  
  function RightFrameLoadEvent() { //Event fires when right frame changes -- However wont fire in Edge for out of domain URLs
    if (mySessionStorage) {  // works in HTML5 
      var c = 0;
      if (mySessionStorage.clickcount) c = Number(mySessionStorage.clickcount);
      if (lastClickCount == c) 
        mySessionStorage.setItem("hw_rightPath", "");  // Clear memory set by NavScript -- NavScript was skipped (so external URL)
      lastClickCount = c;
    }  
  }  
 
  //-->
</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Title Text</title>
</head>

<body onload="OnLoadEvent()" style="margin:0px;overflow:hidden; scrollbar-color:#202020 #353535;background-color:#202020;">
  
  <div id="debugDiv" style="background-color:#ffdddd;"></div> 
  <div id="bannerDiv" style="width:100%;height:0px">
    <iframe id="topFrame" src="" height="100%" name="top" scrolling="no" style="width:100%;height:100%;border:none;padding:0px;margin:0px;overflow:hidden;"></iframe>
  </div><div id="topSpacerDiv" style="width:100%;height:0px;">
  </div><div id="mainDiv" style="height:200px;width:100%;">
    <div id="leftDiv" style="display:inline-block;width:280px;height:100%;">
      <iframe id="leftFrame" src="" hight="100%" name="left" scrolling="no" style="width:100%;height:100%;border:none;padding:0px; margin:0px;overflow:hidden;"></iframe>
    </div><div id="splitterDiv" style="display:inline-block;width:4px;height:100%;cursor:col-resize;background-color: #ff0000;">
    </div><div id="rightDiv" style="display:inline-block;width:300px;height:100%">
      <iframe id="rightFrame" src="" hight="100%" name="right" style="width:100%;height:100%;border:none;padding:0px; margin:0px;overflow:auto;" onLoad="RightFrameLoadEvent()"></iframe>
    </div>
  </div>

<script type="text/javascript">

  // ensure page is not loaded inside another frame
  if (top.location != self.location) {top.location = self.location;} 

  InitializeDocCode();

  // =================================================================================
  // Frame files can be passed in
  //-- eg. thisfile.htm#index2.htm                -- sets the content frame only
  //-- eg. thisfile.htm#index2.htm+hh_search.htm  -- sets the content and nav frame
  //-- eg. thisfile.htm#+hh_search.htm            -- sets the nav frame only
  // =================================================================================
  var LeftFile="hh_toc.htm";    //eg. hh_toc.htm
  var RightFile="ht_contents.htm";  //eg. index.htm (home/default page)
  var TopFile="";      //eg. companybanner.html -- Set "" to hide top banner
  var Param=window.location.hash.substring(1);
  var Params=Param.split("+");
  if (Params.length >= 2) {
    if (Params[1] != "") LeftFile=Params[1];
  }
  if (Params[0] != "") RightFile=Params[0];
  LeftFile = LeftFile + "#" + RightFile;  // pass right frame urk to toc frame

  //is HTML5 sessionStorage available? Then make some info available to the frames
  if (mySessionStorage) {  
    mySessionStorage.setItem("hw_topPath", GetThisFName());  //top filename
    mySessionStorage.setItem("hw_rightPath", "");            //right frame file
  }  
  
  //load frames 
  leftFrame.src = LeftFile;
  rightFrame.src = RightFile;
  if (TopFile !== "")    
    topFrame.src = TopFile;

  //Set User prefs
  if (TopFile !== "") bannerDiv.style.height = 0 + "px";
  else bannerDiv.style.visibility = "hidden";
  splitterDiv.style.backgroundColor = "#333333"; /* Ly */
  splitterDiv.style.width = 2 + "px";

  leftDiv.style.width = 264 + "px";
  leftDiv.style.backgroundColor = "#202020"; /* Ly */

 //rightFrame.style.width = 264 + "px";

//rightFrame.style.scrollbar-color = "hidden";

  topSpacerDiv.style.height = 0 + "px";
  topSpacerDiv.style.backgroundColor = "";

  ResizeDivs();
</script>  

  
</body>
</html>

because I didn't like the red divider nor the white background.

The colors around the files are going to have to be moved to the default.css to make it more flexible and be able to change "color modes" ( light/dark ) on the fly.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
22 minutes ago, bladem2003 said:

already patched some files to make the dark theme

..then I guess I should leave it alone for now because you are still working on it. When you feel that you're good with as far as you took it, I'll play with it.
If you can take a request: make it "sync to toc" when an internal link is clicked, to mimic a CHM.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
29 minutes ago, argumentum said:

..then I guess I should leave it alone for now because you are still working on it. When you feel that you're good with as far as you took it, I'll play with it.
If you can take a request: make it "sync to toc" when an internal link is clicked, to mimic a CHM.

Feel free to play with it and post your results here

Posted

...this ZIP ( down below ) is what my version of the web site would look like but is an alpha.
The JS and CSS are the same. Just the HTM files are not in sync with 3.3.18.0 because is based on the current alpha.
If you can use some of the code from it, have at it :) 

 

11 minutes ago, WildByDesign said:

I am on my phone right now so I can’t look at the files.

Then look at everything once you're back to your PC.

None of this is final and nothing is just one file yet with @bladem2003's compilation. It will take some rewriting/coding to get there.

Also, all these HTM should be loaded with a web server ( I use Apache ) and there are examples all over the forum ( from me too ) to make one with AutoIt.
Loading HTMs as files will not allow some of the feature to work as coded.

Just now, bladem2003 said:

Feel free to play with it and post your results here

I did and the ZIP down below is what I did on my side, long before you came up with yours, ...that 'd like to merge but I don't have much time to "go at it", and "full speed ahead" is my only mode 🤷‍♂️

I like this type too but again, no time  😕

Ok, I'll leave it up to y'all. Make me proud ! 🥹 :D

AutoItWebSite-v3.3.19.0-Alpha_r13287(argumentum).zip

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

All these WYSIWYG CHM compilers use the M$ workshop. So they are wrappers.
The nice thing is the HTM output, and that, we can cook our own in AutoIt. The science behind it is the JavaScript that makes it all work together. If someone feels like tweaking all these to come up with something visually appealing that works by running a script ( because by hand is a "nothing burger" ) then we have something that will work consistently in building the help file.

Then the WebView2 have to work with the AutoIt3Help, and since WebView2 is only the "browser", an HTM daemon serving these HTM files to WebView2 has to work with it all too.
Press "F1" and AutoIt3Help tells the "HTM deamon" to tell the browser to goto "this page" ( or something like that ).

It's an interesting adventure to take on, and a very welcomed product once up and running.

Spoiler

image.png.1e26a355e7032af361798c646625285a.png

Should post: now recruiting "front end", "back end" and "all ends" developer. Must have 30 years experience in: everything :lol:

 

Edited by argumentum
for the lols

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

It's not a one-file solution, but rather an executable and a directory. It works like the AutoIt CHM file. Run the executable from the command prompt and pass a parameter, for example, `_ArrayDisplay`.

I can't upload it here because of the size.

https://limewire.com/d/Xb7Cv#dRSQ6W9M9H

 

#cs ----------------------------------------------------------------------------
     AutoIt Version: 3.3.18.0
     Author:         blade_m2003
#ce ----------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_ProductName=
#AutoIt3Wrapper_Res_ProductVersion=
#AutoIt3Wrapper_Res_LegalCopyright=
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/mo
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Misc.au3>
#include <Timers.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>
#include <IE.au3>


;----if allready runing write to ini and load in the mail loop----
If _Singleton(@ScriptName, 1) = 0 Then
    ;_ArrayDisplay($CmdLine)
    If $CmdLine[0] Then
        $sToFind = $CmdLine[1]
        IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", $CmdLine[1])
    Else
        $sToFind = "_ArrayDelete"
        IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "setontop")
    EndIf
    Exit
EndIf
;--------------------------------------------------------------------


;----if firststart load from cmd----
If $CmdLine[0] Then
    $sToFind = $CmdLine[1]
Else
    $sToFind = "_ArrayFromString"
EndIf
;--------------------------------------------------------------------

Global $oIE = _IECreateEmbedded(), $sLastUrl = ""

$hGui = GUICreate("", 1130, 800)
GUISetBkColor(0x202020)

$iButtonX = 280
Dim $aBtnExample[6][5]
$aBtnExample[0][0] = 5
For $t = 1 To 5
    $aBtnExample[$t][0] = _GuiCtrlCreateButtonEx("Example " & $t, $iButtonX, 5, 80, 22, 0x202020, 0xdddddd, 9)  ;, $FontWight = 400, $Font = "Arial", $FrameColor = 0xaaaaaa)
    _GuiCtrlCreateButtonSetStateEx($aBtnExample[$t][0], $GUI_HIDE)
    $aBtnExample[$t][3] = 0
    $iButtonX += 90
Next

$IEobj = GUICtrlCreateObj($oIE, -2, -0 + 30, 1134, 800 - 33)

$sReadToc = FileRead(@ScriptDir & "\AutoitHelpDark2\AutoIt3 TOC.toc")
$aFindInToc = _StringBetween($sReadToc, $sToFind & '=', @CRLF)

_IENavigateEx($oIE, $IEobj, @ScriptDir & "\AutoitHelpDark2\hh_goto.htm?index.htm#" & $aFindInToc[0])

GUISetState()


AdlibRegister("_Time", 500)

Sleep(1000)
IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "include")
While 1
    Sleep(10)
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit

    For $g = 1 To $aBtnExample[0][0]
        If $msg = $aBtnExample[$g][0] Then
            ShellExecute($aBtnExample[$g][1])
            ExitLoop
        EndIf
    Next


    ;----simple mouse hover-----------------------------
    $posCusorMenu = GUIGetCursorInfo($hGui)
    $iCtrlIDMenu = $posCusorMenu[4]
    For $t = 1 To $aBtnExample[0][0]
        If $t > $aBtnExample[0][0] Then ExitLoop
        If $iCtrlIDMenu = $aBtnExample[$t][0] And $aBtnExample[$t][3] = 0 Then ;$aTabBarItems[$t][4] And $aTabBarItems[$t][16] = 0 Then
            GUICtrlSetBkColor($aBtnExample[$t][0] - 1, 0xFFFFFF)
            $aBtnExample[$t][3] = 1
            ConsoleWrite("HOVER" & @CRLF)
        ElseIf Not $iCtrlIDMenu = $aBtnExample[$t][0] Then ;Or $iCtrlIDMenu = $aTabBarItems[$t][1] Or $iCtrlIDMenu = $aTabBarItems[$t][2] Then
            If $aBtnExample[$t][3] = 1 Then
                GUICtrlSetBkColor($aBtnExample[$t][0] - 1, 0xCCCCCC)
                $aBtnExample[$t][3] = 0
                ConsoleWrite("UNHOVER" & @CRLF)
            EndIf
        EndIf
    Next
    ;--------------------------------------------------



    If IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "") <> "" Then
        If IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "") <> "setontop" Then ;IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "setontop")
            $sToFind = IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "")
            $aFindInToc = _StringBetween($sReadToc, $sToFind & '=', @CRLF)
            _IENavigateEx($oIE, $IEobj, @ScriptDir & "\AutoitHelpDark2\hh_goto.htm?index.htm#" & $aFindInToc[0])
        EndIf
        IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "")
    EndIf
WEnd

Func _Time()
    $sReadUrl = _GetFrameLocationUrl($oIE, 2)
    If $sReadUrl <> $sLastUrl Then
        $sLastUrl = $sReadUrl
        _EnableButtons($sReadUrl)
    EndIf
EndFunc   ;==>_Time


Func _IENavigateEx($oIE, $IEobj, $sUrl)
    GUISetState(@SW_LOCK, $hGui)
    _IENavigate($oIE, $sUrl, 1)
    GUISetState(@SW_UNLOCK, $hGui)
EndFunc   ;==>_IENavigateEx

Func _GetFrameInnerText($o_Object, $i_Frame = 0)
    Local $oFrame = _IEFrameGetCollection($o_Object, $i_Frame)
    Local $iNumFrames = @extended
    Local $sTxt = _IEPropertyGet($oFrame, "innertext")
    ConsoleWrite($sTxt & @CRLF)
EndFunc   ;==>_GetFrameInnerText

Func _GetFrameLocationUrl($o_Object, $i_Frame = 0)
    Local $oFrame = _IEFrameGetCollection($o_Object, $i_Frame)
    Local $iNumFrames = @extended
    Local $sTxt = _IEPropertyGet($oFrame, "locationurl")
    ;ConsoleWrite($sTxt & @CRLF)
    Return $sTxt
EndFunc   ;==>_GetFrameLocationUrl



Func _GuiCtrlCreateButtonEx($sText, $iX, $iY, $iW, $iH, $BG_Color = 0x202020, $Font_Color = 0xffffff, $Fontsize = 8, $FontWight = 400, $Font = "Arial", $FrameColor = 0xaaaaaa, $i_HoverColor = 0xffffff, $iPenSize = 1, $Button_setResize = $GUI_DOCKAUTO)
    Local $n_LabelBorder = GUICtrlCreateLabel("", $iX, $iY, $iW, $iH) ;, 0) ;$iX, $iY, $iW, $iH)
    GUICtrlSetBkColor(-1, $FrameColor)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetResizing(-1, $Button_setResize)

    Local $n_LabelBtn = GUICtrlCreateLabel($sText, $iX + $iPenSize, $iY + $iPenSize, $iW - ($iPenSize * 2), $iH - ($iPenSize * 2), BitOR($SS_CENTER, $SS_CENTERIMAGE))     ;, $iStyle, $iExStyle)
    GUICtrlSetFont(-1, $Fontsize, $FontWight, 0, $Font, 2)
    GUICtrlSetColor(-1, $Font_Color)
    GUICtrlSetResizing(-1, $Button_setResize)     ;$GUI_DOCKALL)
    GUICtrlSetBkColor(-1, $BG_Color)

    Return $n_LabelBtn
EndFunc   ;==>_GuiCtrlCreateButtonEx

Func _GuiCtrlCreateButtonSetStateEx($i_Id, $i_state)
    GUICtrlSetState($i_Id, $i_state)
    GUICtrlSetState($i_Id - 1, $i_state)
EndFunc   ;==>_GuiCtrlCreateButtonSetStateEx

Func _EnableButtons($sRawUrl)
    $sUrlC = StringReplace($sRawUrl, 'file:///', '')
    $sUrlC = StringReplace($sUrlC, '/', '\')
    ConsoleWrite($sUrlC & @CRLF) ;StringReplace($sRawUrl, '/', '\')
    $sData = FileRead($sUrlC)
    If @error = 0 Then
        $aTmp1 = _StringBetween($sData, '<param name="Item1" value=",', ',"')
        If @error = 0 Then
            ;_ArrayDisplay($aTmp1)
            For $h = 1 To $aBtnExample[0][0]
                _GuiCtrlCreateButtonSetStateEx($aBtnExample[$h][0], $GUI_HIDE)
            Next
            For $n = 0 To UBound($aTmp1) - 1
                _GuiCtrlCreateButtonSetStateEx($aBtnExample[$n + 1][0], $GUI_SHOW)
                $sFileName = StringRegExpReplace(StringReplace($aTmp1[$n], "\\", "\"), "^.*\\", "")
                $aBtnExample[$n + 1][1] = 'AutoitHelpDark2\Examples\Helpfile' & "\" & $sFileName
            Next
        EndIf
    EndIf
EndFunc   ;==>_EnableButtons

 

Screenshot_10_.png

Posted

@bladem2003 Nice work. It runs fast and navigation is fast as well.

I just have two suggestions:

It really needs DPI scaling applied to it otherwise everything is a bit blurry on high DPI screens.

; DPI awareness
DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

The other suggestion would be to make the GUI resize. I'm sure you've probably already thought about that. I'm not entirely sure how easy the resizing of the content and frames are though.

Posted

DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)

Is it enough to call it at the beginning, or is something else needed?

Posted (edited)

@bladem2003 By the way, the work that you've done with adding the Example buttons to the top of each help page to run actual, functional examples is incredible. That is something that I've always wished for. Browsing help and running functional examples without needing to actually copy/paste code into an editor an running it. Brilliant work! :thumbsup:

I think that the only thing that bothers me (which is not your fault) is the scrolling of content in that old IE engine stuff. Like the middle wheel scrolling or keyboard gesture scrolling.

EDIT: I have another suggestion for your approach. You can easily make the GUI for your script run as high DPI aware as we just mentioned the DllCall for that. However, all of the Example scripts will still run without DPI scaling.

Some users may want those examples to run with high DPI scaling and some may not. My idea would be to have a checkbox beside the Example button(s) titled something like "High DPI". By default, it could be unchecked and run like it is now.

If a user clicks the "High DPI" checkbox, it could run something like (need to change to AutoIt equivalent code):

REG.exe ADD "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /V "%ProgramFiles(x86)%\AutoIt3\AutoIt3_x64.exe" /T REG_SZ /D "~ HIGHDPIAWARE" /F

Any examples run after that box has been checked would run as high DPI and be sharp and beautiful.

Unchecking that box would remove that registry setting.

Alternatively, checking/unchecking the box could add/remove the DllCall directly in the .au3 example files (*\AutoitHelpDark2\Examples\Helpfile\*). Technically, there are a bunch of different alternative ways that could be used. I'm just not sure which method would be the easier or best.

Edited by WildByDesign
Posted

ad DPI scaling (DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2) ) and GUI resize.

 

@WildByDesign If you want, you can help me with your suggestion for DPI example scripts.

 

#cs ----------------------------------------------------------------------------
     AutoIt Version: 3.3.18.0
     Author:         blade_m2003
#ce ----------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_ProductName=
#AutoIt3Wrapper_Res_ProductVersion=
#AutoIt3Wrapper_Res_LegalCopyright=
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/mo
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Misc.au3>
#include <Timers.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>
#include <IE.au3>
;#include "_GUIDarkMode_v0.02mod.au3"

DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", @AutoItX64 ? "int64" : "int", -2)


;----if allready runing write to ini and load in the main loop----
If _Singleton(@ScriptName, 1) = 0 Then
    ;_ArrayDisplay($CmdLine)
    If $CmdLine[0] Then
        $sToFind = $CmdLine[1]
        IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", $CmdLine[1])
    Else
        $sToFind = "_ArrayDelete"
        IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "setontop")
    EndIf
    Exit
EndIf
;--------------------------------------------------------------------


;----if firststart load from cmd----
If $CmdLine[0] Then
    $sToFind = $CmdLine[1]
Else
    $sToFind = "_ArrayFromString"
EndIf
;--------------------------------------------------------------------

Global $oIE = _IECreateEmbedded(), $sLastUrl = ""

$hGui = GUICreate("", 1130, 800, -1, -1, BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX))
;_GUISetDarkTheme($hGui)
GUISetBkColor(0x202020)

$iButtonX = 280
Dim $aBtnExample[6][5]
$aBtnExample[0][0] = 5
For $t = 1 To 5
    $aBtnExample[$t][0] = _GuiCtrlCreateButtonEx("Example " & $t, $iButtonX, 5, 80, 22, 0x202020, 0xdddddd, 9, 400, "Arial", 0xaaaaaa, 0xffffff, 1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE)
    _GuiCtrlCreateButtonSetStateEx($aBtnExample[$t][0], $GUI_HIDE)
    $aBtnExample[$t][3] = 0
    $iButtonX += 90
Next

$IEobj = GUICtrlCreateObj($oIE, 0, 30, 1128, 745)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)

$sReadToc = FileRead(@ScriptDir & "\AutoitHelpDark2\AutoIt3 TOC.toc")
$aFindInToc = _StringBetween($sReadToc, $sToFind & '=', @CRLF)

_IENavigateEx($oIE, $IEobj, @ScriptDir & "\AutoitHelpDark2\hh_goto.htm?index.htm#" & $aFindInToc[0])

GUISetState()
GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "_WM_EXITSIZEMOVE")

AdlibRegister("_Time", 500)


While 1
    Sleep(10)
    $Msg = GUIGetMsg()
    If $Msg = $GUI_EVENT_CLOSE Then Exit

    For $g = 1 To $aBtnExample[0][0]
        If $Msg = $aBtnExample[$g][0] Then
            ShellExecute($aBtnExample[$g][1])
            ExitLoop
        EndIf
    Next


    ;----simple mouse hover-----------------------------
    $posCusorMenu = GUIGetCursorInfo($hGui)
    $iCtrlIDMenu = $posCusorMenu[4]
    For $t = 1 To $aBtnExample[0][0]
        If $t > $aBtnExample[0][0] Then ExitLoop
        If $iCtrlIDMenu = $aBtnExample[$t][0] And $aBtnExample[$t][3] = 0 Then
            GUICtrlSetBkColor($aBtnExample[$t][0] - 1, 0xFFFFFF)
            $aBtnExample[$t][3] = 1
            ConsoleWrite("HOVER" & @CRLF)
        ElseIf Not $iCtrlIDMenu = $aBtnExample[$t][0] Then
            If $aBtnExample[$t][3] = 1 Then
                GUICtrlSetBkColor($aBtnExample[$t][0] - 1, 0xCCCCCC)
                $aBtnExample[$t][3] = 0
                ConsoleWrite("UNHOVER" & @CRLF)
            EndIf
        EndIf
    Next
    ;--------------------------------------------------



    If IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "") <> "" Then
        If IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "") <> "setontop" Then ;IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "setontop")
            $sToFind = IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "")
            $aFindInToc = _StringBetween($sReadToc, $sToFind & '=', @CRLF)
            _IENavigateEx($oIE, $IEobj, @ScriptDir & "\AutoitHelpDark2\hh_goto.htm?index.htm#" & $aFindInToc[0])
        ElseIf IniRead(@ScriptDir & "\loadpage.ini", "load", "url", "") = "setontop" Then
            WinSetOnTop($hGui, "", 1)
            WinSetOnTop($hGui, "", 0)
        EndIf
        IniWrite(@ScriptDir & "\loadpage.ini", "load", "url", "")
    EndIf
WEnd


Func _Time()
    $sReadUrl = _GetFrameLocationUrl($oIE, 2)
    If $sReadUrl <> $sLastUrl Then
        $sLastUrl = $sReadUrl
        _EnableButtons($sReadUrl)
    EndIf
EndFunc   ;==>_Time



Func _WM_ENTERSIZEMOVE($hwnd, $Msg, $wParam, $lParam)
    GUISetState(@SW_LOCK, $hGui)
    ConsoleWrite(">>>>>_WM_ENTERSIZEMOVE" & @CRLF)
EndFunc   ;==>_WM_ENTERSIZEMOVE

Func _WM_EXITSIZEMOVE($hwnd, $Msg, $wParam, $lParam)
    GUISetState(@SW_UNLOCK, $hGui)
    ConsoleWrite(">>>>>_WM_EXITSIZEMOVE" & @CRLF)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_EXITSIZEMOVE


Func _IENavigateEx($oIE, $IEobj, $sUrl)
    GUISetState(@SW_LOCK, $hGui)
    _IENavigate($oIE, $sUrl, 1)
    GUISetState(@SW_UNLOCK, $hGui)
EndFunc   ;==>_IENavigateEx

Func _GetFrameInnerText($o_Object, $i_Frame = 0)
    Local $oFrame = _IEFrameGetCollection($o_Object, $i_Frame)
    Local $iNumFrames = @extended
    Local $sTxt = _IEPropertyGet($oFrame, "innertext")
    ConsoleWrite($sTxt & @CRLF)
EndFunc   ;==>_GetFrameInnerText

Func _GetFrameLocationUrl($o_Object, $i_Frame = 0)
    Local $oFrame = _IEFrameGetCollection($o_Object, $i_Frame)
    Local $iNumFrames = @extended
    Local $sTxt = _IEPropertyGet($oFrame, "locationurl")
    Return $sTxt
EndFunc   ;==>_GetFrameLocationUrl



Func _GuiCtrlCreateButtonEx($sText, $iX, $iY, $iW, $iH, $BG_Color = 0x202020, $Font_Color = 0xffffff, $Fontsize = 8, $FontWight = 400, $Font = "Arial", $FrameColor = 0xaaaaaa, $i_HoverColor = 0xffffff, $iPenSize = 1, $Button_setResize = $GUI_DOCKAUTO)
    Local $n_LabelBorder = GUICtrlCreateLabel("", $iX, $iY, $iW, $iH) ;, 0) ;$iX, $iY, $iW, $iH)
    GUICtrlSetBkColor(-1, $FrameColor)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetResizing(-1, $Button_setResize)

    Local $n_LabelBtn = GUICtrlCreateLabel($sText, $iX + $iPenSize, $iY + $iPenSize, $iW - ($iPenSize * 2), $iH - ($iPenSize * 2), BitOR($SS_CENTER, $SS_CENTERIMAGE))     ;, $iStyle, $iExStyle)
    GUICtrlSetFont(-1, $Fontsize, $FontWight, 0, $Font, 2)
    GUICtrlSetColor(-1, $Font_Color)
    GUICtrlSetResizing(-1, $Button_setResize)     ;$GUI_DOCKALL)
    GUICtrlSetBkColor(-1, $BG_Color)

    Return $n_LabelBtn
EndFunc   ;==>_GuiCtrlCreateButtonEx

Func _GuiCtrlCreateButtonSetStateEx($i_Id, $i_state)
    GUICtrlSetState($i_Id, $i_state)
    GUICtrlSetState($i_Id - 1, $i_state)
EndFunc   ;==>_GuiCtrlCreateButtonSetStateEx

Func _EnableButtons($sRawUrl)
    $sUrlC = StringReplace($sRawUrl, 'file:///', '')
    $sUrlC = StringReplace($sUrlC, '/', '\')
    ConsoleWrite($sUrlC & @CRLF)
    $sData = FileRead($sUrlC)
    If @error = 0 Then
        $aTmp1 = _StringBetween($sData, '<param name="Item1" value=",', ',"')
        If @error = 0 Then
            For $h = 1 To $aBtnExample[0][0]
                _GuiCtrlCreateButtonSetStateEx($aBtnExample[$h][0], $GUI_HIDE)
            Next
            For $n = 0 To UBound($aTmp1) - 1
                _GuiCtrlCreateButtonSetStateEx($aBtnExample[$n + 1][0], $GUI_SHOW)
                $sFileName = StringRegExpReplace(StringReplace($aTmp1[$n], "\\", "\"), "^.*\\", "")
                $aBtnExample[$n + 1][1] = 'AutoitHelpDark2\Examples\Helpfile' & "\" & $sFileName
            Next
        EndIf
    EndIf
EndFunc   ;==>_EnableButtons

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...