AppleScript.GetPropertyName
---------------------------

Queries name of property with given index.

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

MBS( "AppleScript.GetPropertyName"; Script ID; Index ) 

**MBS**( **"AppleScript.GetPropertyName";** /\* Queries name of property with given index. \*/  
**$Script ID**; /\* The Id of the script you want to execute. This ID returned by the [AppleScript.Compile](AppleScriptCompile.md) function.e.g. 1 \*/   
**$Index**) /\* The index of the property from 0 to [AppleScript.PropertyCount](AppleScriptPropertyCount.md)-1.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Script ID | The Id of the script you want to execute. This ID returned by the [AppleScript.Compile](AppleScriptCompile.md) function. | 1 |
| Index | The index of the property from 0 to [AppleScript.PropertyCount](AppleScriptPropertyCount.md)-1. | 0 |

### Result

Returns name or error.

### Description

Queries name of property with given index.  
Last error is set.  
### Examples

List properties by name:

 Set Variable \[ $scriptID ; Value:MBS ( "[AppleScript.Compile](AppleScriptCompile.md)"; AppleScript Properties::AppleScriptCode ) \]   
If \[ MBS ("isError") \]  
 Show Custom Dialog \[ Message: MBS ("[AppleScript.LastErrorMessage](AppleScriptLastErrorMessage.md)"); Buttons: “OK”, “Cancel” \]  
 Exit Script \[ \]   
End If  
Set Variable \[ $count ; Value:MBS ( "[AppleScript.PropertyCount](AppleScriptPropertyCount.md)"; $scriptID ) \]   
Set Variable \[ $list ; Value:"" \]  
Set Variable \[ $i ; Value:0 \]  
If \[ GetAsNumber($count ) &gt; 0 \]  
 Loop  
 Set Variable \[ $n ; Value:MBS ( "Applescript.GetPropertyName"; $ScriptID ; $i ) \]   
 Set Variable \[ $list ; Value:$list &amp; $n &amp; ¶ \]  
 Set Variable \[ $i ; Value:$i +1 \]  
 Exit Loop If \[ $count = $i \]  
 End Loop  
 Show Custom Dialog \[ $count &amp; " Properties"; $list \]   
End If  
Set Variable \[ $r ; Value:MBS ( "[AppleScript.Close](AppleScriptClose.md)"; $scriptID ) \]  
### See also

- [AppleScript.Close](AppleScriptClose.md)
- [AppleScript.Compile](AppleScriptCompile.md)
- [AppleScript.GetPropertyValue](AppleScriptGetPropertyValue.md)
- [AppleScript.LastError](AppleScriptLastError.md)
- [AppleScript.LastErrorMessage](AppleScriptLastErrorMessage.md)
- [AppleScript.PropertyCount](AppleScriptPropertyCount.md)
- [AppleScript.SetPropertyValue](AppleScriptSetPropertyValue.md)
- [IsError](IsError.md)

This function checks for a license.

Created 18th August 2014 , last changed 4th September 2025

  
[AppleScript.Execute](AppleScriptExecute.md) - [AppleScript.GetPropertyValue](AppleScriptGetPropertyValue.md)

[HTML Version](AppleScriptGetPropertyName.shtml)