AppleScript.LastError
---------------------

Returns the last error code.

| 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.LastError" ) ### Parameters

none

### Description

Returns the last error code.  
Any AppleScript Errors that are not trapped using "try" blocks, will abort the AppleScript. Also returns AppleScript compile errors. This function is useful for error trapping your scripts.  
### Examples

Get Last Error

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

- [AppleScript.Compile](AppleScriptCompile.md)
- [AppleScript.Execute](AppleScriptExecute.md)
- [AppleScript.GetPropertyName](AppleScriptGetPropertyName.md)
- [AppleScript.LastErrorMessage](AppleScriptLastErrorMessage.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.
- **Version 13.2**
    - Added [AppleScript.LastErrorPosition](https://www.mbsplugins.eu/AppleScriptLastErrorPosition.shtml) function.

### Blog Entries

- [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)

This function is free to use.

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

  
[AppleScript.GetPropertyValue](AppleScriptGetPropertyValue.md) - [AppleScript.LastErrorMessage](AppleScriptLastErrorMessage.md)

[HTML Version](AppleScriptLastError.shtml)