How to use new JavaScript engine in UltraEdit for Windows 2023.0?

How to use new JavaScript engine in UltraEdit for Windows 2023.0?

231
Basic UserBasic User
231

    Apr 29, 2023#1

    Hello community,

    I have updated to 64-bit UltraEdit 2023.0.0.41.
    There should now be a new JS engine integrated.
    But: let, padEnd ... still do not go? 😢

    Can I read somewhere what exactly has been added?

    Greetings Frank
    (Translated with DeepL)
    Win11 (64bit) 23H2 - UE 2024.0.0.35 64bit

    6,678579
    Grand MasterGrand Master
    6,678579

      Apr 30, 2023#2

      I could not find any detailed information about the JavaScript engine used in UltraEdit for Windows v2023.0 in any email to the beta testers, in latest newsletter and on web page about the latest changes in UltraEdit for Windows 2023.0.

      But there is written on the latest changes page:
      • Application scripting update
        • Modern JavaScript support and full browser capabilities
        • Legacy JavaScript support by default for full backwards compatibility
        • Enable latest JavaScript by adding header to script: // @Engine=WebView2
      There must be downloaded and installed Microsoft Edge WebView2 on not being installed by default (depends on version of Windows) and used on execution of the UltraEdit script by adding to the UltraEdit script file at top the comment: // @Engine=WebView2

      The following script code works without and with the comment line at top. In other words it works with UltraEdit for Windows v13.10 and all newer versions of UltraEdit on Window XP to Windows 11 22H2.

      Code: Select all

      // @Engine=WebView2
      var sTest1 = "Test engine";
      if (typeof(sTest1.padEnd) == "function")
      {
         sTest1 = sTest1.padEnd(50,".");
      }
      else
      {
         while (sTest1.length < 50) sTest1 += ".";
      }
      UltraEdit.outputWindow.write("sTest1: " + sTest1);
      
      // My preferred solution for fixed width field values output into text files.
      var sPadDots = "..................................................";
      var sTest2 = "Test engine";
      sTest2 += sPadDots.substr(sTest2.length);
      UltraEdit.outputWindow.write("sTest2: " + sTest2);
      There is used Microsoft Edge WebView2 with execution of sTest1 = sTest1.padEnd(50,"."); on running this script with 32-bit UltraEdit for Windows v2023.0.0.41 on Windows 11 Version 22H2 (OS Build 22621.1413) without having installed manually Edge WebView2 as installed by default with this version of Windows.
      Best regards from an UC/UE/UES for Windows user from Austria

      231
      Basic UserBasic User
      231

        Apr 30, 2023#3

        Hi Mofi
        Mofi wrote:
        • Enable latest JavaScript by adding header to script: // @Engine=WebView2
        There must be downloaded and installed Microsoft Edge WebView2 on not being installed by default (depends on version of Windows) and used on execution of the UltraEdit script by adding to the UltraEdit script file at top the comment: // @Engine=WebView2

        There is used Microsoft Edge WebView2 with execution of sTest1 = sTest1.padEnd(50,"."); on running this script with 32-bit UltraEdit for Windows v2023.0.0.41 on Windows 11 Version 22H2 (OS Build 22621.1413) without having installed manually Edge WebView2 as installed by default with this version of Windows.
        So, when I enter '// @Engine=WebView2', the script does not work.
        It starts, but no output... except 'Scripting Engine: Using WebView2'.

        Without entry it runs. ('else' - part) 'Scripting Engine: Using Spidermonkey'

        WebView2 is installed.

        Windows 10 22H2 (64-bit), UltraEdit 2023.0.0.41 64-bit

        Greetings
        (Translated with DeepL)
        Win11 (64bit) 23H2 - UE 2024.0.0.35 64bit

        6,678579
        Grand MasterGrand Master
        6,678579

          May 01, 2023#4

          There is output on execution of the posted script with 32-bit UltraEdit for Windows v2023.0.0.41 on Windows 11 22H2 into the output window with the configuration settings Show status information in output window checked at Advanced - Settings or Configuration - Scripting:

          Code: Select all

          Scripting Engine: Using WebView2
          Running script: C:\Temp\Test.js
          ========================================================================================================
          sTest1: Test engine.......................................
          sTest2: Test engine.......................................
          Script succeeded.
          The first line of the output changes on inserting a space character in the comment // @Engine=WebView2 between @ and Engine. The output is in this case:

          Code: Select all

          Scripting Engine: Using Spidermonkey
          Running script: C:\Temp\Test.js
          ========================================================================================================
          sTest1: Test engine.......................................
          sTest2: Test engine.......................................
          Script succeeded.
          Microsoft Edge WebView2 is currently (2023-05-01) of version 1.3.173.55 on my PC with Windows 11.

          I still use always the 32-bit version of UltraEdit on 64-bit Windows for being able to quickly switch to an older archived version for answering a question in the user-to-user forums regarding to an older version of UltraEdit. I have not installed or tested 64-bit UltraEdit for that reason.

          The version of WebView2 can be seen according to information on the Microsoft documentation page Distribute your app and the WebView2 Runtime by running following:
          • In a 64-bit command prompt window on 64-bit Windows:

            Code: Select all

            reg.exe QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3C4FE00-EFD5-403B-9569-398A20F1BA4A}" /v pv /reg:32
            
            reg.exe QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3C4FE00-EFD5-403B-9569-398A20F1BA4A}" /v pv
            
            reg.exe QUERY "HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" /v pv
          • In a 32-bit command prompt window on 64-bit Windows or in a command prompt window on 32-bit Windows:

            Code: Select all

            reg.exe QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3C4FE00-EFD5-403B-9569-398A20F1BA4A}" /v pv
            
            reg.exe QUERY "HKEY_CURRENT_USER\Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" /v pv
          One of the command lines should not output the error message:

          Code: Select all

          ERROR: The system was unable to find the specified registry key or value.
          Microsoft Edge WebView2 is not installed on all reg.exe executions output this error message (or the command lines were not correct copied and pasted into the command prompt window).

          Please see also the Microsoft documentation page Microsoft Edge WebView2 - Policies and the other policies pages as listed on left side in the menu.
          Best regards from an UC/UE/UES for Windows user from Austria

          231
          Basic UserBasic User
          231

            May 28, 2023#5

            Hello!

            Am I really the only one for whom // @Engine=WebView2 does not work?

            I have Windows 10 (64-bit) and UltraEdit 2023.0.0.41 64-bit installed.
            I have already tried all constellations (64/32-bit). But nothing works.

            The output shows:

            Code: Select all

            Scripting Engine: Using WebView2
            Running script: G:\Own files\UltraEdit\Scripts\create Header - next Level.js
            Script succeeded.
            But the script is not executed.

            Support could not help me either :-(

            Does anyone have an idea what else I can do?

            Greetings Frank
            (Translated with DeepL)
            Win11 (64bit) 23H2 - UE 2024.0.0.35 64bit

            6,678579
            Grand MasterGrand Master
            6,678579

              May 28, 2023#6

              Is drive G: a drive of local hard disk or a network drive?

              Most browsers are configured by default to block execution of scripts stored on network drives or network resources like a shared folder accessed using UNC path. The Microsoft Edge WebView2 Runtime could be no exception regarding this security limitation as far as I could find out with some searches in world wide web although my own test as described below returned a different result because of the execution of an UltraEdit script with Edge WebView2 from a network drive worked fine.

              It is a currently known issue that the Fixed Version of the WebView2 Runtime does not work at all on a network drive. That does perhaps not matter here because I think, but do not know it for sure, UltraEdit uses the automatically updated Evergreen Runtime, but I would not be surprised that the execution of the script is moved to a local drive and executed from within UltraEdit.

              I copied header.js as installed with UltraEdit to a shared folder on network-attached storage of my company connected as network drive with a drive letter and accessed from home using a VPN tunnel, inserted at top of the script file on network drive // @Engine=WebView2, saved and closed the script file, added the script on network drive to the Script list, opened a new file and executed the script on network drive from the Script list. That worked as I could see in the output window showing that WebView2 was used as script engine and of course the new file on which the header lines were added by the script.

              I could see further that UltraEdit or Edge WebView2 created in directory %APPDATA%\IDMComp\UltraEdit a subdirectory EWebView with subdirectories and files taking in total 21,749,880 bytes.

              Is the directory with the application data files of UltraEdit in your configuration also in the directory %APPDATA%\IDMComp\UltraEdit on a local drive or is the UEINIDIR environment variable or the command line option /i= used for using a different directory on a network drive as UltraEdit application data directory with the INI file and all other user configuration files?

              Do you use English UltraEdit on English Windows or UltraEdit in a different language or Windows in a different language?

              I could be helpful to download, extract to a directory on local drive, and run as administrator the free Windows Sysinternals (Microsoft) tool Process Monitor to find out what is going on in background on Edge WebView2 is started by UltraEdit on script execution.
              Best regards from an UC/UE/UES for Windows user from Austria