How can I make the Execute an AppleScript text area preview the compiled version?

The AppleScript in an Execute an AppleScript action eventually displays the AppleScript I've provided in the "Execute text script" field of the action but I haven't isolated the precise event that makes that happen. If I wait long enough so that typing a character or two then pressing ⌘-z only removes the character or two I just typed, then the compiled version is displayed. What direct gesture makes it get there? Thanks.

Darn it, I meant to say the action eventually displays the compiled version of the AppleScript...

(I'm trying not to edit my posts so much). Sorry.

Try pressing the Enter key as described here:

1 Like

Thanks. Must have had the wrong context somehow when I tried Enter. I'm also used to ⌘-K.

1 Like

Plus, there are so many contexts where Enter inserts a line feed, break, or carriage return (such as in the posting editor that I'm using as I type this), and MacBook and MacBook Pro keyboards are conspicuously missing an Enter key. I really need to learn to emulate that key, I've gone too long without it.

Enter on MacBook Pro keyboard is just :globe_with_meridians:(fn)-return. Oh, well, the more it hurts to learn, the longer it stays with you, I guess.

It’s all a bit of a pain isn’t it - I just use the enter key on my numpad!

Yep. Well, maybe. I've "learned" the fn-return move for this exact purpose several times.

1 Like

I was tripping over this lately, too. It turns out that there are syntax errors that the compiler cannot recover from enough to parse the rest of the script, so those errors can throw you back into plain text mode. Until you find and fix the error(s), pressing Enter or Fn+Return will still leave you in text mode.

You can demo this to yourself, if that kind of thing helps you learn. Look at a working AppleScript script that has a structure of the form:

tell application "...whatever..."
end tell

Then add an erroneous "to" to the end of the tell line, e.g.,:

tell application "...whatever..." to
end tell

That's enough of an error to confuse the compiler. If you press Enter or Fn+Return at this point, you will switch to text only view and you won't get out of it until you fix the error.

At least, that's my experience. YMMV.