Automate Malwarebytes virus scan

Malwarebytes has a free, lightweight virus scanner for Mac. But you don't get the ability to schedule scans unless you buy the paid version. Fortunately, it's possible to schedule the scans yourself using macOS tools like AppleScript and Automator. The instructions below detail how.
 * 1) The process requires Accessibility Inspector, a program that comes with Xcode. If you don't have Xcode installed, you can get it for free in the App Store.
 * 2) Launch Accessibility Inspector.
 * 3) Launch Malwarebytes.
 * 4) Click the target icon in Accessibility Inspector. This is labeled with a green arrow in Figure 1, below. After clicking the target icon, click the Malwarebytes window. This will highlight the Malwarebytes window in green and populate Accessibility Inspector with information about the Malwarebytes user interface (UI).
 * 5) In Accessibility Inspector, expand the Hierarchy field (see Figure 1). This reveals the structure of the Malwarebytes UI. The application is made up of a single window (called Malwarebytes for Mac and labeled with a blue 1), which in turn is composed of five different groups: Header, Center, Detection History, Scanner, and Real-Time Protection. These groups are labeled in Figure 1 with the red numerals 1-5.Malwarebytes UI.png
 * 6) Double-click the Scanner group. This reveals the components that make it up, one of which is a button labeled "Scan".
 * 7) macOS can initiate a scan by clicking the scan button. The specific instruction we need to provide is to click the "Scan" button, which is in the 4th group (the Scanner group) of the first window (the Malwarebytes for Mac window) of the Malwarebytes application. This instruction can be coded in AppleScript as follows. The first piece of the script opens Malwarebytes; the second clicks the "Scan" button:
 * 8) Now we need to schedule the AppleScript to be run on a regular basis. Open the Automator app, select Calendar Alarm as the document type, and click Choose.
 * 9) In the Automator app window, use the Name field at the top to search for Run AppleScript. Drag it to the workflow area on the right. This will insert the stub for an AppleScript into the workflow area.
 * 10) Copy the AppleScript from Step 7 to the place in the AppleScript stub that says "(* Your script goes here *)".
 * 11) Save the Automator workflow. This will add a scan as a calendar appointment in the Calendar app, and attempt to run the scan. Before the scan can run successfully though, you'll see two different dialog boxes open where you'll need to grant the workflow permission to run.
 * 12) Adjust the calendar appointment to the schedule you desire. For example, I set the scan to run daily at 2:37 AM.
 * 1) Adjust the calendar appointment to the schedule you desire. For example, I set the scan to run daily at 2:37 AM.