Jump to content

Fantastical Workflow


Recommended Posts

  • 6 months later...

I've amended this on my Alfred to allow a modifier after the date to choose whether to add the event directly, or to open Fantastical to review first.

set str to q as string
set AppleScript's text item delimiters to " " as string
considering case
	set len to str's last text item's length
end considering
set AppleScript's text item delimiters to ""
set theend to text ((-(" "'s length) - len) + 1) thru -1 of q
set q to text 1 thru (-(" "'s length) - len) of q
if theend does not contain "rev" then
	tell application "Fantastical" to parse sentence q with add immediately
else
	tell application "Fantastical" to parse sentence q
end if

If you add 'rev' after the text for the new event, you can review in fantastical first; if rev doesn't appear, then the event is added directly. To change the default, change the line 

if theend does not contain "rev" then

to 

if theend contains "add" then

and use the phrase 'add' afterwards to force it be added directly.

Link to comment
  • 1 year later...

@theboyler - I'm not proficient with scripting at all. Where would I copy your enhancement to the exisisting workflow script. What I've done is this.

 

on alfred_script(q)

tell application "Fantastical"

  parse sentence q

end tell

end alfred_script

 

set str to q as string

set AppleScript's text item delimiters to " " as string

considering case

set len to str's last text item's length

end considering

set AppleScript's text item delimiters to ""

set theend to text ((-(" "'s length) - len) + 1) thru -1 of q

set q to text 1 thru (-(" "'s length) - len) of q

if theend does not contain "rev" then

tell application "Fantastical" to parse sentence q with add immediately

else

tell application "Fantastical" to parse sentence q

end if

 

 

Any help would be greatly appreciated!

 

Rick

Link to comment

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
×
×
  • Create New...