Re: Silently Executing "tell" Commands?
Re: Silently Executing "tell" Commands?
- Subject: Re: Silently Executing "tell" Commands?
- From: Christopher Nebel <email@hidden>
- Date: Tue, 04 Mar 2014 16:04:08 -0800
On Feb 2, 2014, at 5:46 PM, Alex Hall <email@hidden> wrote:
> Is it possible to run a tell command without the app launching, or at least not opening fully? For instance, say i made a service that ran a script. This script popped up a basic text input box, then took that input and added it to a Reminders list. I don't normally have Reminders open - I manage that on my phone - but I would like to be able to jot down a reminder when I'm using the mac. However, especially on my machine, apps can take a bit to launch, and I'm one who doesn't keep things open in the background if I'll hardly ever use them. So, I'd like this script to add the reminder without the full Reminders app launching and then sticking around. If nothing else, is there a way to get success/failure messages from Reminders, then tell the app to close on success? Some sort of background system would be best, but short of that, a way to "clean up" as the script goes would be better than nothing. To be clear, this isn't just for Reminders, that's just the first app I thought of. Thanks!
By definition, an application must be running in order to send it a command via “tell”. [1] However, if AppleScript needs to launch an application in order to send it a command, it will launch it hidden. This may not take any less time, but it does mean less visual clutter. Of course, if you tell it to “display dialog” or some such, it will necessarily become visible again.
That said, some applications are merely front ends for a system framework. For example, you don’t have to use Finder to manipulate files; you can use the file system calls directly using AppleScriptObjC. [2] Reminders.app is a front end for the EventKit framework, so in theory you could write a script that used EventKit directly — changes made in your script would appear in Reminders. In practice, this means learning to use EventKit, which is not nearly as straightforward as scripting Reminders, but it would work.
—Chris N.
[1] With a special exception for “quit” — if you tell an application that isn’t running to quit, AppleScript will simply do nothing.
[2] Or for that particular case you could use System Events, but the point here is to introduce AppleScriptObjC.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden