AppleScript.LastErrorMessage
----------------------------

Returns the last error message.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [AppleScript](component_AppleScript.md) | [1.0](newinversion10.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |

MBS( "AppleScript.LastErrorMessage" ) ### Parameters

none

### Description

Returns the last error message.  
Any AppleScript Errors that are not trapped using "try" blocks, will abort the AppleScript. AppleScript Compile errors are also reported here. This function is useful for error trapping your scripts.  
### Examples

Get the Last Applescript Error as text

 MBS ( "Applescript.LastErrorMessage")  
### See also

- [AppleScript.Compile](AppleScriptCompile.md)
- [AppleScript.Execute](AppleScriptExecute.md)
- [AppleScript.GetPropertyName](AppleScriptGetPropertyName.md)
- [AppleScript.LastError](AppleScriptLastError.md)
- [AppleScript.LastErrorPosition](AppleScriptLastErrorPosition.md)
- [CNContact.SetValue](CNContactSetValue.md)

### Release notes

- **Version 14.0**
    - Fixed [AppleScript.Compile](https://www.mbsplugins.eu/AppleScriptCompile.shtml) to clear last error for [AppleScript.LastErrorMessage](https://www.mbsplugins.eu/AppleScriptLastErrorMessage.shtml) function.

### Example Databases

- [OS Scripting/AppleScript Print with Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/OS%20Scripting/AppleScript%20Print%20with%20Preview.shtml#1ScriptAnchor_)
- [OS Scripting/AppleScript Properties](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/OS%20Scripting/AppleScript%20Properties.shtml#1ScriptAnchor_)
- [OS Scripting/Email Text from Apple Mail](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/OS%20Scripting/Email%20Text%20from%20Apple%20Mail.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 13.6pr1](https://www.mbsplugins.de/archive/2023-12-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Read and write notes in Contacts](https://www.mbsplugins.de/archive/2023-11-19/Read_and_write_notes_in_Contac/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 13.2](https://www.mbsplugins.de/archive/2023-05-17/New_in_MBS_FileMaker_Plugin_13/monkeybreadsoftware_blog_filemaker)
- [Send text message from FileMaker via iMessage](https://www.mbsplugins.de/archive/2019-03-10/Send_text_message_from_FileMak/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 31st October 2016

  
[AppleScript.LastError](AppleScriptLastError.md) - [AppleScript.LastErrorPosition](AppleScriptLastErrorPosition.md)

[HTML Version](AppleScriptLastErrorMessage.shtml)