AppleScript result output FAQ: How can I display the output of my AppleScript script (the AppleScript result)?
Cool, I just learned how to get AppleScript output to show up in the ScriptEditor Result tab. In short, just leave a string at the end of your AppleScript script, and it is printed in the ScriptEditor Result tab.
ScriptEditor Result output: An AppleScript output "Hello world" example
Here's a quick AppleScript result example that puts "Hello world" in the ScriptEditor Result tab:
"hello, world"
Really, that's all you have to do. Just put that in the AppleScript ScriptEditor, press Run, and you'll see "hello, world"
in the ScriptEditor Result tab.
To make it a little more complicated you could write a script like this:
set r1 to "hello" set r2 to "world" r1 & ", " & r2
Actually, it gets even a little more interesting. The following AppleScript example will also print "hello, world"
in the Result tab:
set r1 to "hello, world"
Beyond that, it looks like whatever you leave at the end of your program is printed in the ScriptEditor Result tab. Here's one last example before I go. First I display a dialog:
display dialog "foo"
and here's what ends up in the Result tab:
{button returned:"OK"}
AppleScript result output
I hope this AppleScript ScriptEditor Result tab information has been helpful. If you have any questions (or answers, lol), feel free to leave a note in the Comments section below.