property asanapath : "/Users/dbyler/.rbenv/shims/asana" property workspace : "Calorie" on log_item(myTask) set myTask to my replace_chars(myTask, "\"", "\\\"") do shell script asanapath & " \"" & workspace & " " & myTask & "\"" end log_item on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text end replace_chars on handle_string(myTask) --LaunchBar direct input my log_item(myTask) end handle_string on alfred_script(q) --Alfred direct input log_item(myTask) end alfred_script on run --direct run set mystring to text returned of (display dialog "New Asana task in " & workspace & ": " default answer "") my log_item(mystring) end run