Jump to content
Sheldon

Can Alfred trigger a workflow on a specific day and time?

Recommended Posts

Hi forum.  I recently purchased the Alfred PowerPack and am looking forward to leveraging its power.

 

I've added a few custom workflows that are triggered by hotkeys which run some NSAppleScripts.  I'd like to do the same for a few more, but triggered automatically at a specific time each week (e.g. "every Friday @ 6pm").

 

I don't see a workflow object that is triggered by date or time.

 

Is this possible in Alfred?

Share this post


Link to post

Nope.

 

Alfred's philosophy is strictly to keep as low a profile as possible until the user explicitly runs it.

 

OSX already has a first-rate system for scheduling tasks in launchd, and you should use that.

 

That said, the XML format is a PITA (compared to cron), so you want something like LaunchControl (an awesome app for creating LaunchAgents).

 

You can call workflows from launchd by via AppleScript and Alfred's External Triggers.

Share this post


Link to post

Nuts, though I can appreciate the design philosophy.

 

Could you point me to some AppleScript that show how to trigger a workflow using an external trigger?

Share this post


Link to post
3 hours ago, deanishe said:

That said, the XML format is a PITA (compared to cron), so you want something like LaunchControl (an awesome app for creating LaunchAgents).

 

As another suggestion, there’s also launched. It doesn’t manage the LaunchAgents, but makes it easy to make them with the correct XML.

Share this post


Link to post

I found a way that doesn't involve additional software.

  1. Open a new Automator workflow
  2. Add a "Run Applescript" action
  3. Paste the sample Alfred code provided by the External Trigger
  4. Save it as an app
  5. In the Mac system preferences, open "Security & Privacy"
  6. Under "Privacy", add your new Automator workflow app
  7. Open Calendar
  8. Create a new event
  9. Edit the event (i.e. double-click the event, then click on the start date/time )
  10. Add an alert to "Open file"
  11. Select the Automator workflow app
  12. If desired, change the events time or date, and even set it to repeat every day, week, month, or year.

What little testing I've done so far seems to verify this works.  I'll update this thread if I find a problem.

 

Please note that I first tried the Mac Automator "Calendar Alarm" document type to accomplish the same results but the script never triggered at the specified time.

Share this post


Link to post
23 minutes ago, Sheldon said:

I found a way that doesn't involve additional software.

 

 

launchd isn’t additional software, it comes with macOS. LaunchControl is merely a tool that makes it easier to work with it, and launched is a website to make (and install) launchd plists.


That said, whatever works for you, but making an Automator workflow is definitely taking the long route. At least make a script with the Script Editor app.

Share this post


Link to post
9 hours ago, Sheldon said:

 

I found a way that doesn't involve additional software.

 

 

launchd is a core part of the OS. It is responsible for booting the system. It is the "right" way the schedule tasks on a Mac.

 

Share this post


Link to post

No worries. Poor choice of words.  I meant not needing LaunchControl or similar software for managing launchd Launch Agents.

Share this post


Link to post
On 31/03/2017 at 3:55 PM, Sheldon said:

No worries. Poor choice of words.  I meant not needing LaunchControl or similar software for managing launchd Launch Agents.

 

Right, got you. Yeah, you definitely don't want to try writing a Launch Agent by hand.

Share this post


Link to post

This can't still be true in Dec. 2018!!! I'm super pissed that I purchased this app specifically for this functionality only to find out that this app doesn't do this. Like I'm MEGA pissed right now. Everyone I talked to told me this app was an easy to use way to create apple script style workflows which is exactly what I need to automate my radio station on this computer. Super upset with this.

Share this post


Link to post

Welcome @Cullen,

 

1 hour ago, Cullen said:

This can't still be true in Dec. 2018!!!

 

This objection doesn’t really make sense. As explained earlier in this thread, Alfred wants to be explicitly called by design. In that sense, complaining it “still” doesn’t do something it never proposed itself to is like complaining newer lightbulbs still can’t be used to scramble eggs. Alfred isn’t failing to do scheduled tasks; it’s not trying to.

 

1 hour ago, Cullen said:

Everyone I talked to told me this app was an easy to use way to create apple script style workflows

 

And it is. And it’s also easy to have a Workflow trigger at a specific time, by leveraging other tools or native macOS functionality, as explained above. We’d be more than happy to help you with that, if you have a specific question.

 

1 hour ago, Cullen said:

I'm super pissed that I purchased this app specifically for this functionality only to find out that this app doesn't do this. Like I'm MEGA pissed right now.

 

There’s no reason to. Alfred’s team isn’t a major corporation trying to rip you off. Rather, it’s a lovely couple (and a cat) that cares deeply for their users and their satisfaction above all. Together with the tight and helpful community in this forum, we’ll do our best to get you sorted. But we will need you to be more specific about what you want to accomplish and where your difficulty lies.

Share this post


Link to post
12 hours ago, vitor said:

(and a cat)

 

Is the cat named Alfred ?  My eyeballs will roll so hard they'll leave my face if this is so.

Share this post


Link to post

I think @vitor has provided as good an answer as I could've done for the earlier question, so all I can contribute on this Friday afternoon is a cat picture ;) 

 

jackandrose.jpg

 

Two of the four members of the Alfred team; Rose and Jack*, who are now rather bigger than they were then... They are very important team members, mostly ensuring team happiness and providing reminders to take dinner breaks on busy days :) 

 

[And no, their names are not from Titanic...]

 

Cheers,
Vero

Share this post


Link to post
17 hours ago, vitor said:

Alfred’s team isn’t a major corporation trying to rip you off. Rather, it’s a lovely couple (and a cat) that cares deeply for their users and their satisfaction above all. 

 

Good to know. But look, I never claimed anyone was trying to rip me off. I claimed that I was upset because an application designed to simply create and run Apple Scripts that costs $26 for the basic "power pack" doesn't have the capability to run scripts at a specific date and time.

 

It seems like too simple of an add on to not exist. There are no third party "work flows" that might incorporate the running of a script at a specific day and time?

 

Here's what I am trying to do. I need to program various Mac applications and iTunes Playlists to trigger specific tasks when I need them to. For example, I need the butt (broadcast using this tool) application to trigger the 'Go Live' (PLAY button) function at 7 PM nightly, and at the same time, have an iTunes playlist play that is connected to a live stream from a talk show called Free Talk Live (one of my network's affiliates). Then, at 10 PM, I need the butt application to stop live streaming (STOP  button) and, at the same time, I need the network automation live stream pulled up on Google Chrome which I have saved as a Chrome bookmark, and have the page set to refresh itself every 30 minutes in case of playback error. That's just one example of something that I need done. It sounds like Alfred could probably do ALL of this, except trigger at the specific day and time I need it to automatically.

Edited by Cullen

Share this post


Link to post

The only reason I'm hesitant to bring in another Apple automation app to cue the scripts is because I'm already using 3 automation systems to run the station, and I downloaded Alfred to automate those. So with another app, I will have an app to automate the app that's automating the radio station's automating apps. Sound frustrating?

Share this post


Link to post
40 minutes ago, Cullen said:

It sounds like Alfred could probably do ALL of this, except trigger at the specific day and time I need it to automatically.

 

What you describe sounds like 95+% scripting, tbh, and doesn't really have a whole lot to do with Alfred. I mean, Alfred can launch your scripts via a keyword or a hotkey or even a snippet, but it doesn't provide any tools to help automate clicking buttons or playing playlists because Alfred's a launcher, not an automation toolbox.

 

Unless all your apps have automation APIs, that sounds like it might be quite a fragile workflow and hard to get right.

 

Edited by deanishe

Share this post


Link to post

Well if I need to, apparently the automator app has a way I can just record mouse strokes, and that's free with the app.

 

Share this post


Link to post
31 minutes ago, Cullen said:

Well if I need to, apparently the automator app has a way I can just record mouse strokes, and that's free with the app.

 

 

That's what's very fragile. Simulating mouse clicks is basically just blindly clicking a fixed location on the screen. It's up to you to make sure the right application is under the mouse, not under any other windows and in the right mode to begin with. And there's generally no way of telling whether or not it worked from your script.

 

Edited by deanishe

Share this post


Link to post
4 hours ago, Cullen said:

Well if I need to, apparently the automator app has a way I can just record mouse strokes, and that's free with the app.

 

So that has approximately zero percent chance of long-term success.

 

I think the app you were after was probably Keyboard Maestro and not Alfred.

Share this post


Link to post
On 12/7/2018 at 7:17 PM, CJK said:

 

So that has approximately zero percent chance of long-term success.

 

I think the app you were after was probably Keyboard Maestro and not Alfred.

 

Well, at least you're offering real solutions.

 

Will this operate on a timer?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×