1

I have a local app (NotePlan) installed on macOS, and it publishes an x-callback-url scheme. I'm simply trying to call it from a ruby script, but can't find help on this. (Plenty of help available for HTTP calls, but this is to a local app.)

require 'open-uri'
title = "note title"
uri = "noteplan://x-callback-url/openNote?noteTitle=#{title}"
uriEncoded = URI.escape(uri)
response = open(uriEncoded).read

It returns this error:

No such file or directory @ rb_sysopen - noteplan://x-callback-url/openNote?noteTitle=note%20title (Errno::ENOENT)

From the command line calling open "noteplan://x-callback-url/openNote?noteTitle=note%20title" does the expected thing, so the basic mechanism appears to work.

JGC
  • 505
  • 1
  • 4
  • 12

1 Answers1

0

Well, I've found a way, though I regard it a hack, not a good answer.

response = %x[open "#{uri}"]

i.e. call the open command in a new shell.

I still hope someone can provide a better answer.

JGC
  • 505
  • 1
  • 4
  • 12