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

using app.openUrl to open file in browser loses colon

Engaged ,
Jan 04, 2019 Jan 04, 2019

Copy link to clipboard

Copied

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

Views

992

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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"')

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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"')

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

-a, --annotate

  Make an unsigned, annotated tag object

Likes

Translate

Translate

Report

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