What is the Script Editor?
Overview
Lightning Review provides an API to allow users to develop their own functions (extensions).
(For details, please refer to the following link: "API Reference")
The Script Editor allows you to write and execute scripts to manipulate Lightning Review using this API.
- This is useful for automating operations or processes that cannot be performed from the Lightning Review screen.
Example: Batch editing of review file templates, filtering of comments based on special conditions, etc. - Created scripts can be easily shared with team members.
Developing extensions requires a certain level of C# programming knowledge and involves the effort of creating NuGet packages. With the Script Editor, even with introductory C# knowledge, you can implement "simple functions" by relying on input assistance features (IntelliSense).
Installation
- Click [Tools] menu - [Manage Extensions] to launch the [Manage Extensions] dialog.
- Select and install the following individually from [Denso Create Official]:
- LightningRevie.Interop
- ScriptEditor
-
Click the [Install] button.
-
Restart Lightning Review.
To display explanations of methods and properties using the input assistance feature, you need to install the .NET 6 SDK.
The .NET 6 SDK installer can be downloaded from the following link: "Microsoft site"
How to use
Here's how to use the script editor.
First, from the [Tools] menu - [Script Editor], display the [Lightning Review Script Editor] dialog box.
The following screen will be displayed.
Preparation
Click "Open Folder" and specify the location where the script editor's output file will be stored.
All files described below are those stored in the folder specified here.
If you do not specify a folder, the output will be to the following default folder:
C:\Users(username)\AppData\Local\DENSO CREATE\Lightning Review ScriptEditor\Scripts
:::
Writing the Script
Afterward, write and execute the script as shown in the following video.
-
Write the script you want to execute in the "Editor" pane of the Script Editor.
-
Click "Save".
Running the Script
- Display the "Lightning Review Script Editor" dialog box.
- Double-click the script you want to run in the "Explorer" pane to open it.
- Click "Run Script" to execute the script written in the "Editor" pane.
Sharing Scripts
You can share scripts you've created with other members.
You can access scripts created by others in the following ways:
- When you write and save a script, a file with the extension ".csx" will be created.
- If you store the above file in the folder specified by "Open Folder," the file will appear in "Explorer."
How to Write Scripts
Please write your script as follows. For details, please refer to the following link.
- How to write (C#): "Script Creation and Command Line Execution Example"
In the "Editor" pane, you can use input assistance features similar to Visual Studio.
- API to call: "API List"
Sample
As an example of how to write a script, the following code shows how to "add members in bulk to a template file".
For details, please refer to the following link: Sample List
//When there are dozens of uncorrected issues, you can filter to display only those that should be corrected as a priority.
//As an example, a filter is applied to display only issues that meet the conditions of 'High Priority', 'Status: Uncorrected', and 'Corrector Undetermined'.
//Set the member name you want to add below
var memberNames = new [] {"Kondo"};
//Set the folder containing the template files you want to add below
var templateFolder = @"C:\Git\lightning-review-operational-test\Docs\Engineering\Current\07_PeerReview\Templates";
var directoryInfo = new DirectoryInfo(templateFolder);
var files = directoryInfo.GetFiles("*.revx");
var service = App.GetReviewFileService();
foreach(var file in files)
{
var review = service.OpenReview(file.FullName);
foreach(var memberName in memberNames)
{
//Add member
var newMember = review.ReviewSetting.AddMember(memberName);
newMember.Reviewee = true;
newMember.Reviewer = true;
newMember.Moderator = true;
}
//Save and close
service.SaveReview(file.FullName, review);
service.CloseReview(review);
}
Notes on Script Execution
The following are notes on running the script editor.
- Do not close the script editor while the script is running.
If you close it, the process will be interrupted. (No error will be displayed.) - Keep the running script editor active while the script is running.
If you switch to another window midway, the process may be performed on the active window. - When executing the process to update the review file from the script editor, close the review file.
- If you are using Windows Task Scheduler to periodically run the script, ensure the user is logged in.
As long as the user is logged in, it is okay even if the screen is locked using Windows' screen lock function.