Need script to run a link

I have some links I use frequently, and realized if I had a script for each link, I could place them on my Toolbar and thus access them more easily.

Anyone know if there’s a simple script somewhere to just run a link in OO? (Forgive my total lack of scripting ability…)

Yes, that is certainly possible. .open method of URL class allows that possibility. For example, you can try running in the Automation Console:

URL.fromString('https://www.omnigroup.com/blog/').open()

To execute that Omni Automation code from the toolbar:

  • click Add Action (Automation Console).
  • Paste that code below // Add code to run when the action is invoked in the .omnijs script that is opened.

Hi - thanks so much for this. It took a little trying, but it now works, and I’ve got the icon in my toolbar. Very cool.

1 Like

New day, new problem. I was able to create three scripts and place them on my document-specific toolbar. But now, when I try to create a new script, I click on Add Action, and no script appears in the Automator console. Just blank. I’ve quit OO and re-opened, but still get the same empty console window after clicking “Add Action”.

Any ideas what I’m doing wrong?

Can you post a screenshot ?

I’ve just opened console and clicked “New Action”.

You can see that the Untitled Action" icon has been added to the console’s toolbar, but below is nothing. No code is generated into which I can insert my string.

And every time this happens, OO hangs and I have to Force Quit.

Does this dialog ever appeared to you when you click “New Action” ?

What version of OO are you using ? I’m on 5.6.1 (v200.5.0).

The template script appears on the text file opened when you click “Add” on that dialog. Is that what you experienced ?

Yes, that’s the dialog I get. I click on Add, and then the empty console window appears. Note: it worked fine the first three times I tried it. Clicking Add opened up the window with the template script into which I inserted the my link. Now, no template script appears.

I too am running 5.6.1 (v200.50).

I created five scripts with that method but unfortunately, I cannot reproduce the behaviour you are describing.

You could try deleting toolbar scripts and removing those icons.

Another option would be manually creating the .omnijs file with this template:

/*{
	"type": "action"
}*/
(() => Object.assign(
    new PlugIn.Action(selection => {

        // main :: IO ()
        const main = () => {
            URL.fromString('https://www.omnigroup.com').open()
        };

        return main()
        
        }, {
            validate: selection => true
        })
))();

and then saving it in your Plug-ins folder.

Good solution. Thanks.

Thanks for the solution, i was also looking for it

this forum is very helpful.. .