Jump to content

Error when posting to Todoist with Applescript


Recommended Posts

I am trying to post to Todoist using these scripts: http://blog.nik.me/post/38392029513/todoist-applescripts-services-and-applescript-api

 

The error I get is this:

[ERROR: alfred.workflow.action.applescript] {
    NSAppleScriptErrorBriefMessage = "Expected \U201cend\U201d but found \U201cproperty\U201d.";
    NSAppleScriptErrorMessage = "Expected \U201cend\U201d but found \U201cproperty\U201d.";
    NSAppleScriptErrorNumber = "-2741";
    NSAppleScriptErrorRange = "NSRange: {20, 8}";
}

Does anyone have any ideas how to fix this? Thanks!

 

Here's the start of my Applescript:

on alfred_script(q)
property apiToken : "apitokenremoved"
property allProjects : {}
property appName : "Nik's crappy scripts"
property appDomain : "me.nik.crappyscripts"

on run
	
	set {text returned:textReturned, button returned:buttonReturned} to ¬
		display dialog ¬
			"Enter Todoist task..." with icon 1 buttons {"Cancel", "OK"} ¬
			default button ¬
			"OK" default answer ""
	
	if buttonReturned is "OK" then
		my newTask(textReturned)
	else if buttonReturned is "Cancel" then
		
	else
		
	end if
	
	
end run
Link to comment

 

I am trying to post to Todoist using these scripts: http://blog.nik.me/post/38392029513/todoist-applescripts-services-and-applescript-api

 

The error I get is this:

[ERROR: alfred.workflow.action.applescript] {
    NSAppleScriptErrorBriefMessage = "Expected \U201cend\U201d but found \U201cproperty\U201d.";
    NSAppleScriptErrorMessage = "Expected \U201cend\U201d but found \U201cproperty\U201d.";
    NSAppleScriptErrorNumber = "-2741";
    NSAppleScriptErrorRange = "NSRange: {20, 8}";
}

Does anyone have any ideas how to fix this? Thanks!

 

Here's the start of my Applescript:

on alfred_script(q)
property apiToken : "apitokenremoved"
property allProjects : {}
property appName : "Nik's crappy scripts"
property appDomain : "me.nik.crappyscripts"

on run
	
	set {text returned:textReturned, button returned:buttonReturned} to ¬
		display dialog ¬
			"Enter Todoist task..." with icon 1 buttons {"Cancel", "OK"} ¬
			default button ¬
			"OK" default answer ""
	
	if buttonReturned is "OK" then
		my newTask(textReturned)
	else if buttonReturned is "Cancel" then
		
	else
		
	end if
	
	
end run

 

You'd have to do some manipulating of the original Add Todoist Task.scpt file to incorporate this into Alfred natively. To integrate directly into Alfred you have to have JSON Helper installed first off. Next, you'd probably want to remove the Growl functions and the place in the add task area that calls the growl functions. Then you would need to replace the AppleScript input prompt with just setting the text value to q (passed in from the on_alfred_script function). 

 

I'm not sure how comfortable you are with scripting and AppleScript. I can help you if you'd like, or.. a way to make this a LOT easier it just to paste in your API key into the Add Todoist Task.scpt, comment out the one line that calls the growl functions, and just have Alfred launch that from Alfred from a Run Script. Now, this would use the AppleScript  prompt to still ask for the new task text but it works easily. To do this, you'd just copy in all the scripts you downloaded into the workflow folder and then from a run script just do..

osascript "Add Todoist Task.scpt"

As mentioned, I'm not sure how you want to set this up. This way works but if you want to not have the AppleScript prompt and want it integrated into Alfred a little more, let me know and I'll help ya out. Just to make sure I don't miss it though, if you want, you can email me directly about this at david@alfredapp

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...