Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

using app.openUrl to open file in browser loses colon

Engaged ,
Jan 04, 2019 Jan 04, 2019

var path="Users/bagonterman/Desktop/";

var file="Tutorial.pdf"

var colon="%3A"

var colon=":"

app.openUrl("file"+colon+"///"+path+file);

I would like to either open up a pdf or html and I can do neither because when I send this the colon disappears.

It shows up like this file///Users/bagonterman/Desktop/Tutorial.pdf . I think that it may be because it is automatically putting http:// in front

and then it does not accept the colon after that. Any ideas as to how I could get around this?

TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 04, 2019 Jan 04, 2019

For now I have no idea how to make that worked the way you tried, but temporarily you may use this method:

app.system('start chrome.exe "file:///Users/bagonterman/Desktop/Tutorial.pdf"')

However I'm on Windows with Chrome browser, but it should work on Mac if you choose other browser and 'open' command instead of 'start'. By the way, if I changed 'chrome.com' to just 'chrome' it works as well since I installed it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 04, 2019 Jan 04, 2019

I tried this and received a 256.Maybe I need to look at how that runs on the mac side. It might not be exe

app.system('open chrome.exe "file:///Users/bagonterman/Desktop/Tutorial.pdf"')

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 04, 2019 Jan 04, 2019

Okay this is what I ended up using for the mac side.

Thank you for your help!

app.system('open -a "Google Chrome" "file:///Users/bagonterman/Desktop/Tutorial.pdf"')

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 04, 2019 Jan 04, 2019

How did you find it, on Google or yourelf, and what is that -a parameter?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 04, 2019 Jan 04, 2019

I looked up how to open the file with a mac terminal. I don't know what the a tag does but it works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 04, 2019 Jan 04, 2019
LATEST

-a, --annotate

  Make an unsigned, annotated tag object

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines