kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 129 forks source link

Is it possible to open PDF or Word file? #311

Closed seabornlee closed 2 years ago

seabornlee commented 2 years ago

I tried Task, or require child_process, neither can do it.

kasper commented 2 years ago

Hey @seabornlee, yes! Try Task.run('/usr/bin/open', ['file-you-want-to-open.pdf']);?

seabornlee commented 2 years ago

Thanks very much! It would be great if have this example in docs.

kasper commented 2 years ago

Good idea, I’ll add it! 👍

seabornlee commented 2 years ago

@kasper When path contains space, it won't open, what should I do?

kasper commented 2 years ago

@seabornlee Hey! The same as you would do in a terminal. Escape it or put the path in quotes. https://apple.stackexchange.com/questions/14683/how-to-cd-to-a-directory-with-a-name-containing-spaces-in-bash

seabornlee commented 2 years ago

Thanks!