openURL Script?

I can’t figure out how openURL works. I will be replacing the URLs with the KeyboardMaestri actions URLs but for the sake of figuring out how this works, I included basic links. Does not seem to work. Please advise,


var one = ‘’;
var two = ‘www.duckduckgo.con’;
var p = Prompt.create();

p.title = “Export Report to Pages”;
p.message = “Which Clinic?”;


var didSelect =;

if (p.buttonPressed == “one”) {
else {Safari.openURL(‘’);

I am wondering if it might be just the protocol missing on that strings.

Did you try ‘

That worked on my iPhone.

1 Like

As @Andreas_Haberle notes, to make it a URL you need the protocol. It isn’t a URL without it.

But you have also added

else {Safari.openURL('');

but Safari is not a Drafts class and not one you have defined.

Try changing that to be app; maybe more like this.

else app.openURL('');

Also don’t forget to use triple back ticks for your code blocks to stop the forum changing some of the characters; you look to have used a comment block and it has and your quotation marks.

I figured it out. Thank you.


var gbppc = 'kmtrigger://macro=MVA%20Report%20-%20GBPPC';
var allied = 'kmtrigger://macro=MVA%20Report%20-%20Allied%20Med';

var p = Prompt.create();

p.title = "Export Report to Pages";
p.message = "Which Clinic?";

p.addButton('Allied Med');;

if (p.buttonPressed == 'GBPPC')	{app.openURL(gbppc);
	else {app.openURL(allied);