Using Record to start a script

    Recording the steps you take to perform a task is an easy way to start a script. Try creating this example script:
    1 In the Script Editor, click Record.
    2 Click to make the Finder active.
    3 Open the Edit menu and choose Preferences.
    4 Select a Grid Spacing option, then close Preferences.
    5 Click Stop.

    When you finish, you'll see this script in the window:

    Show me the recorded script example.

    This script is ready to use. If you save it and place it on your desktop, you can easily change the Grid Spacing preference to Wide any time you want.

    After recording a script, you may need to edit it. Although the example script works, it's actually more complicated than it needs to be. You can use the comment symbol to "comment out" the lines that are not needed:

    Show me the edited example.

    The script still works because AppleScript doesn't have to make the Finder active or open the Preferences dialog box to set the grid spacing.

    Of course, you may want to change the recorded script to perform variations of the task. For example, you can change the example script to set the Grid Spacing to Tight by changing the Set statement:

    set uses wide grid of Finder preferences to false

 


Table of contents