Q01: Yes, that is the active file. It is not an UltraEdit script file with file extension
.js which in the past on former versions of UltraEdit prevented the usage of the command
Run active script. That is not the case anymore with UltraEdit for Windows v2023.1.0.23 on using the ribbon mode or the toolbar/menu mode with contemporary menus. Just in toolbar/menu mode with traditional menus there is missing in menu
Scripting the command
Run active script if the active file has not the file extension
.js. It is not useful clicking on the command symbol
Play script in ribbon mode or in toolbar/menu mode with contemporary menus to execute the internal command
Run active script of UltraEdit because of the active file is a text file and not a script file. The JavaScript interpreter outputs an error message and exits the script execution immediately. That can be seen in the output window.
Q02: Yes and no. It depends on how the script is written.
If the script uses mainly
UltraEdit.activeDocument.* commands and properties, the usage of the UltraEdit internal command
Run active script makes of course no sense as the script would run on itself and not on the data file. Such a script must be added to the
Scripts list for using it on data files.
The possibilities for running a script in the
Scripts list on active file are as follows on using the ribbon user interface mode:
- A click is made on the text Play script with the down arrow below the symbol Play script on ribbon tab Advanced for opening the Scripts list and clicking next in this list on the appropriate script from the list for running it on the active file.
- There can be opened also the Script list view by clicking on ribbon tab Layout on the check box item Scripts. Then the appropriate script can be executed on active file with a double click on the script in the list view. The Script list view can be docked on any side of the main application window without or with auto-hide feature enabled or as floating window as all view windows.
- The assigned hotkey or chord (multi-key assignment) is pressed which is assigned to a script in the Scripts list opened by clicking on ribbon tab Advanced on the symbol All scripts. I recommend to use chords for multiple scripts in the Scripts list, i.e. there is used Ctrl+Alt+S or on German keyboard AltGr+S as first key combination and a single letter key according to first character of the name of the script file as second key for all the scripts in the Scripts list.
- The ribbon is customized by adding a custom ribbon tab with name Tools and a group with name Scripts on which the scripts in the Scripts list are added as commands to the custom ribbon tab for execution by using the pointing device. That custom ribbon could contain also a group Macros with macros to execute on active file and a group Tools with user tools to execute on active file.
- The document window context menu is customized and the script from the Scripts list is added to the document window context menu for being able to right click on active document window and left click on the script file name in the opened document window context menu for executing it on active file.
- The file tab context menu is customized and the script from the Scripts list is added to the file tab context menu for being able to right click on a file tab and left click on the script file name in the opened file tab context menu for executing it on active file. A right click on a file tab makes the appropriate file automatically the active file.
It is of course also possible coding a script which does not work with active document, i.e. when it must process all files in a folder. For such a script it is possible to open the script file and click on symbol
Play script for running it.
I wrote also several scripts posted in this forum where the script is designed for execution using
Run active script. The script first checks if the active file has the file extension
.js.because of being executed with command
Run active script. In this case the script code changes the active document to either document 0 (most left on file tabs bar) on not being already the active file (script file is most left file) or to document 1 (second file on file tabs bar) on existing at all and perhaps checks again the file extension. Then the script continues and reformats the file or whatever is coded for the data file. Such a code makes it possible running the script on a file from the
Scripts list or opening the data file and the script file in any order (first data file and second script file or first script file and second data file) and use the command
Run active script executed on the script file.