1
tell application "BBEdit"
    activate
    tell window 1
        repeat 100 times
            repeat 5 times
                key code 124
            end repeat
            --select insertion point after character 5
            keystroke return
            --keystroke key code 36
        end repeat
    end tell
end tell

gives error

error "BBEdit got an error: Can’t get keystroke \"
\" of window 1." number -1728 from keystroke "
" of window 1

All I want to do is emulate moving the cursor 5 spaces and press the return key lots and lots of time.

Seemed simple enough...

JulianB
  • 1,686
  • 1
  • 19
  • 31

1 Answers1

2
delay 0.2
tell application "BBEdit"
    activate
    tell window 1
        repeat 100 times
            repeat 5 times
                tell application "System Events"
                    key code 124
                end tell
            end repeat
            tell application "System Events"
                keystroke return
            end tell
        end repeat
    end tell
end tell
JulianB
  • 1,686
  • 1
  • 19
  • 31