AppleScript system info access error

Running the following in Script Editor or Script Debugger (7 and 8)

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

set machine to computer name of (system info)

yields an “Access not allowed” error similar to what is pictured in the screenshot, below. (Disregard short user name, computer name yields the same error.)

This is on macOS Big Sur 11.12.1 on an M1 MacBook Air.

Pointers greatly appreciated!

machine is an AppleScript term, so you can’t use it as a variable name. Try set machineName to....

Turns out the problem is machine is a reserved word! Using machineName instead works fine.

Sort of embarrassing given the accuracy of the error message and that for a hot nanosecond I considered using machineName but laziness got the best of me. :joy:

Thanks, ShaneStanley, for the tip!