Customize Script Notification

To configure the script settings select “Script Notification” in the Halt Notifier window and click Settings (see Figure 1). The Script Settings window opens (see Figure 2).

Figure 1: Script Notification Settings

enablescript.gif

Figure 2: Script Settings Window

scriptsettings.gif

In the Script Settings window, you select the script file you want to execute when a halt occurs. The window also shows a list of default scripting languages that are supported. You can add or remove any scripting language or reset the list to the default scripting languages.

Select a Script File

To use Script Notification, you must select a script file in the Script Settings window.

To choose a script file, click Browse. See Figure 3. The script file language should be within the list of scripting languages in the Script Settings window. If it does not match, add the scripting language (see Add a Scripting Language) to the list and then select the script file.

Figure 3: Select Script

selectscript.gif

When MPLAB® X IDE encounters a breakpoint, the selected script is executed and the output of the script file, if any, will be directed to the MPLAB X IDE output window. The Project name, Project directory, Debug directory and reason for halt information will be passed as an argument along with the script (see example below).

Example: Python script to send a text message via Verizon

A script can contain whatever actions you want to take place when a halt occurs. One example is sending a text message. See the next two topics on how to send a text message using WhatsApp and Twitter.

Send a Text Message Using Yowsup and WhatsApp Messenger

Yowsup is a python library that lets you use the WhatsApp service. It allows you to login and provides you with all the capabilities of an official Whatsapp client. You can create a full-fledged custom Whatsapp client. Refer to this url for more details:
https://github.com/tgalal/yowsup

Send a Text Message Using Twitter

There are several Twitter API’s available for sending messages. All of Twitter’s APIs are based on the HTTP protocol. Any software you write which uses Twitter’s APIs sends a series of structured messages to Twitter’s servers.

There are many scripting languages supported by Twitter. Refer to this link for more details:
https://dev.twitter.com/overview/api/twitter-libraries

Add a Scripting Language

To add a scripting language, click Add. A new row is created within the list. See Figure 4.

Double-click in each empty field (do not use the <TAB> key) and type in the appropriate Display Name, Executable, and Extension. When done, press the <ENTER> key. Then, you can Select a Script File.

Figure 4: Add a Scripting language

addscript.gif

Delete a Scripting Language

To delete a scripting language from the list, click anywhere in the row to be deleted and click Delete. See Figure 5. Default scripting languages cannot be deleted.

Figure 5: Delete a Scripting Language

deletescript.gif

Reset the Language List

To return the scripting language list to the default settings, click Reset. See Figure 6 and Figure 7 for before and after reset views.

Figure 6: List Before Reset

beforereset.gif

Figure 7: List After Reset

afterreset.gif
© 2017 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.