If a scriptable application is also recordable, it translates user actions into AppleScript code. This is effectively the same AppleScript code that would be used to perform those same actions programmatically. Common examples (perhaps the only examples) of recordable applications are BBEdit and the Finder.
To start recording user actions:
Choose Script > Record (or click the Record button in the toolbar) and switch to the recordable application.
Or, if you’re already in the recordable application, choose Record from Script Debugger’s Dock menu.
Once you’ve started recording user actions, perform actions directly in the recordable application. Script Debugger will record the AppleScript equivalent of each action. When you’re done recording:
Switch to Script Debugger and choose Script > Stop (or click Stop in the toolbar).
Or, choose Stop from Script Debugger’s Dock menu.