On Oct 11, 2015, at 08:06, Yvan KOENIG <email@hidden> wrote:
#1 I would move the instruction triggering display dialog out of the tell application block because "display dialog" is not a "Reminders" command.
Depending on how the script gets executed, "display dialog" and the like *need* to be inside a "tell app" block, otherwise you have no control over which app it will appear in. It doesn't matter that it's not a command implemented by the app. It still works just fine. Steve via iPad
I never encapsulate display dialog in the driven application. To be sure that the dialog appears at front I use:
tell application "SystemUIServer" to display dialog…
This app is designed to drive the User Interface so it's the neater one to fit our needs. In the Original codes, there were not only display dialog but path to resource and path to application which were encapsulated in a tell application "System Events" block.
In what the asker posted, there is no reason to encapsulate display dialog.
If what was posted is a subset of a longer script, I would use:
path to resource "Reminders.icns" in bundle (path to application "Reminders")
tell application "SystemUIServer" to set reminTitle to text returned of (display dialog "Create a new reminder" default answer "" buttons {"Cancel", "Create"} default button 2 cancel button 1 giving up after 20 with icon result) if reminTitle > "" then tell application "Reminders" make new reminder with properties {name:reminTitle} end tell end if
Yvan KOENIG (VALLAURIS, France) dimanche 11 octobre 2015 16:33:25
|