display dialog without dock alert

I have a stay-open script with a “display dialog” window as its user interface. The user selects an option, the script runs and then displays the dialog again. The problem is that I want the dialog to reappear in the background and wait without causing the bouncing dock alert. The last thing the script does before the dialog reappears is open a folder of images for editing, so I don’t want to return to the script immediately or have it bounce in the dock, which is very distracting. Here’s a sample bit of the offending code:

tell application "Finder" to open folder "photos" using (path to application "Photo Mechanicâ„¢")
display dialog "User options..."

Any suggestions would be greatly appreciated. I think the main difficulty is that I can’t have the script do anything (like activate Photo Mechanic) after the display dialog command.

Thanks, WF

Hi

I was helped out with a similar issue this week.

How about only displaying the dialog when the user switches to the application where you want the dialog to appear.

For example, if you want it to appear when the user is in the Finder, how about something like this:


repeat
tell application “System Events” to set FRontApp to name of (first application process whose frontmost is true)
if FRontApp = “Finder” then
tell application FRontApp
display dialog “User options…” giving up after 3
end tell
exit repeat
end if
end repeat


This will avoid any bouncing dock item

Thanks Kiwilegal,

You are more or less describing my current solution although there’s no need to watch with the loop since the script application itself is the one displaying the dialog. At the moment I have it so the dialog appears when the script application is activated or reopened. It’s just easier to activate when there’s already a big dialog window to click on. I don’t like having to click on the dock icon every time. Maybe I’m just lazy, but it just seems like a more elegant solution to have the dialog window in the background ready to use (as if it were a standard application window).

WF

Thanks a lot Jacques,

That seems to do the trick. I didn’t realize that something like that could be done to the application itself.

WF