Jump to content

What's wrong with my 2do script?


Recommended Posts

set inputStr to "{query}"
set my text item delimiters to " :"
set taskName to first text item of inputStr
set listName to last text item of inputStr
set urlScheme to "twodo://x-callback-url/add?task="taskname"&forList="ListName"
tell application "System Events"
	open location urlScheme
end tell

 

 

I realise there are myriad problems with this but I'm trying to understand why. 

I'm trying to get a list name into 2do but I think I'm having a problem with url encoding. 

I tried various things (turning the result back into a query and passing that query on to the browser search feature in Alfred etc. 

What am I doing wrong?

 

Link to comment
On 9/19/2021 at 12:59 PM, bongobong said:

I'm trying to get a list name into 2do but I think I'm having a problem with url encoding.

 I don't think you're getting that far. The way you're trying to join the URL is all wrong. It needs to be:

 

set myVariable to "some string" & someVariable & "another string"

 

You forgot the & signs.

 

As regards URL-encoding: AppleScript can't do it. Unless you can find a function someone has written, you'll need to use a different language for that.

Link to comment
On 9/20/2021 at 9:31 PM, deanishe said:

 I don't think you're getting that far. The way you're trying to join the URL is all wrong. It needs to be:

 

set myVariable to "some string" & someVariable & "another string"

 

You forgot the & signs.

 

As regards URL-encoding: AppleScript can't do it. Unless you can find a function someone has written, you'll need to use a different language for that.

Thanks Deanishe. Will try and fix. 
 

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