Alternative to "AppleScript Runner" for displaying a dialog?

Following some suggestions in this forum, I use AppleScript Runner (a built-in app in OS X) to display dialog boxes when I want to display a dialog while letting my script continue to run while the dialog is displayed.

I use this kind of code to launch the dialog:

do shell script "osascript -e 'tell application \"AppleScript Runner\"  to activate'"
do shell script "osascript -e 'tell application \"AppleScript Runner\"  to display dialog \"Text of dialog goes here.\" & return & return & \"Please wait.\" buttons {\"Operation in process.\"} with title \"My Sample Code\" giving up after 60' &> /dev/null &"

When a later step in the script is reached, and I want to close the dialog, I use this code:

set asrProcess to quoted form of "AppleScript Runner"
try
	do shell script "killAll " & asrProcess
end try

For reasons that I can’t describe here, it will soon be necessary to replace “AppleScript Runner” with some other application, probably in the next few weeks. (I’ll be able to state the reason before too long, but you may be able to guess it now.)

Can anyone suggest a faceless application that is part of OS X (so that my users won’t need to install it), and which I can start up and shut down without doing any damage? I can’t use System Events, for example, because I can’t stop it as I do with AppleScript Runner. I’ve looked into the applications in Core Services (/System/Library/CoreServices) and can’t see anything that would obviously work.

Thanks for any help.

I don’t know that you’re going to find a suitable sacrificial offering. But with a little patience you might find better alternatives.

On reading this note, I’ve decided to be VERY patient. Thank you!

OK, you’ve been patient enough. If you go to www.macosxautomation.com/applescript/apps/explorer.html, as well as my new app you will see a link to download some sample scripts. One of them is called Progress dialog.asobjcex3doc. It might give you some more ideas.

I’m on my way, Shane! Thank you!

By the way, I’ve also found that using Automator Runner instead of Applescript Runner seems to work well - at least for everything I’ve tried.

That is definitively something I’ll try.

In the mean time, having forgot about this thread, I figured out/remembered, that run script is an internal Applescript command. In my specific case, the place I used Applescript runner, was from an applet on Finders toolbar, so now I hope I can just have Finder perform the run script instead! :slight_smile:

Edit

Substituting Finder for AppleScript Runner worked perfectly in my case.

In my scripts, it sometimes has the effect of bringing Finder windows frontmost, which can be distracting.

Hello.

I understand that. In my case, I want to end up with Finder active, when I’m done.

Here is an alternative. (You can of course just grab the name of the frontmost app, before you run the script.)

And there is a lot of cases, where such a scheme won’t work, but they say osascript can perform gui now, so at least there shouldn’t be a reason for writing a launchd plist to make it work, But maybe that is the case sometimes.

tell application (path to frontmost application as text)
	run script "{Display dialog \"hello\"}"
end tell

Edit

Maybe you must check that the frontmost Application supports scripting terminology, before trying to make it run a script!

StandardAdditions, actually. :slight_smile:

Thanks.

I should have checked with the dictionary. I believe there may be situations it won’t work so well then, like with other commands in the Standard Additions, save delay.

:slight_smile:

tell application "TextEdit"
	run script "tell app \"Finder\" to get item 1 of startup disk"
end tell
tell application "TextEdit"
	run script "tell app \"Finder\" to display dialog \"Nice!\" with icon 1"
end tell