Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

AppleScript.GetPropertyName

Queries name of property with given index.

Component Version macOS Windows Linux Server iOS SDK
AppleScript 4.2 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ❌ No
MBS( "AppleScript.GetPropertyName"; Script ID; Index )   More

Parameters

Parameter Description Example
Script ID The Id of the script you want to execute. This ID returned by the AppleScript.Compile function. 1
Index The index of the property from 0 to AppleScript.PropertyCount-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"; AppleScript Properties::AppleScriptCode ) ]
If [ MBS("isError") ]
    Show Custom Dialog [ Message: MBS("AppleScript.LastErrorMessage"); Buttons: “OK”, “Cancel” ]
    Exit Script [ ]
End If
Set Variable [ $count; Value:MBS( "AppleScript.PropertyCount"; $scriptID) ]
Set Variable [ $list; Value:"" ]
Set Variable [ $i; Value:0 ]
If [ GetAsNumber($count) > 0 ]
    Loop
        Set Variable [ $n; Value:MBS( "Applescript.GetPropertyName"; $ScriptID; $i ) ]
        Set Variable [ $list; Value:$list & $n & ¶ ]
        Set Variable [ $i; Value:$i+1 ]
        Exit Loop If [ $count = $i ]
    End Loop
    Show Custom Dialog [ Title: $count & " Properties"; Message: $list; Buttons: “OK”, “Cancel” ]
End If
Set Variable [ $r; Value:MBS( "AppleScript.Close"; $scriptID) ]

See also

This function checks for a license.

Created 18th August 2014, last changed 15th February 2022


AppleScript.Execute - AppleScript.GetPropertyValue