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

[JS] ScriptUI - URL Links in Dialogues

Participant ,
Nov 19, 2012 Nov 19, 2012

Copy link to clipboard

Copied

HI.

I have a left field question, is it possible to put a hyperlink to a web URL in a scriptUI window?

I have some video tutorials that I want to be able to link to from the UI and at the moment all I can do is have a button going to a new alert/promt containing a url instructing the user to copy and paste in their browser.

Screen Shot 2012-11-20 at 9.33.34 AM.png

Can this link be directly placed as a hyperlink in the palette?

Just wondering...

Cheers

Roy

TOPICS
Scripting

Views

2.7K

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

correct answers 1 Correct answer

Guru , Nov 20, 2012 Nov 20, 2012

Hi Roy,

Make a button and use a code like this one from Harbs

See http://forums.adobe.com/message/4390237#4390237

GotoLink()

function GotoLink(url){

            url = url || "http://in-tools.com";

            if(app.version>6){

                if(File.fs=="Macintosh"){

                    var body = 'tell application "Finder"\ropen location "'+url+'"\rend tell';

                    app.doScript(body,ScriptLanguage.APPLESCRIPT_LANGUAGE);

                } else {

                    var body =  'dim objShell

...

Votes

Translate

Translate
Guru ,
Nov 20, 2012 Nov 20, 2012

Copy link to clipboard

Copied

Hi Roy,

Make a button and use a code like this one from Harbs

See http://forums.adobe.com/message/4390237#4390237

GotoLink()

function GotoLink(url){

            url = url || "http://in-tools.com";

            if(app.version>6){

                if(File.fs=="Macintosh"){

                    var body = 'tell application "Finder"\ropen location "'+url+'"\rend tell';

                    app.doScript(body,ScriptLanguage.APPLESCRIPT_LANGUAGE);

                } else {

                    var body =  'dim objShell\rset objShell = CreateObject("Shell.Application")\rstr = "'+url+'"\robjShell.ShellExecute str, "", "", "open", 1 '

                    app.doScript(body,ScriptLanguage.VISUAL_BASIC);

                }

            }

            else {

                linkJumper = File(Folder.temp.absoluteURI+"/link.html");

                linkJumper.open("w");

                var linkBody = '<html><head><META HTTP-EQUIV=Refresh CONTENT="0; URL='+url+'"></head><body> <p></body></html>'

                linkJumper.write(linkBody);

                linkJumper.close();

                linkJumper.execute();

            }

        }

Regards

Trevor

Votes

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
Participant ,
Nov 20, 2012 Nov 20, 2012

Copy link to clipboard

Copied

Nice.  Thanks for that.  Works a treat! (and thanks Harbs too)

Roy

Votes

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
Guru ,
Oct 15, 2018 Oct 15, 2018

Copy link to clipboard

Copied

Kals​ recently marked my answer as helpful so I thought I would post my preferred openURL function.

function openURL(url, useHttps) {

    // by Trevor http://creative-scripts.com

    if (!/^http/.test('' + url)) {

        url = (useHttps ? 'https://' : 'http://') + url;

    }

    if ($.os[0] === 'M') { // Mac

        app.doScript('open location "URL"'.replace(/URL/, url), ScriptLanguage.APPLESCRIPT_LANGUAGE);

    } else { // Windows

        app.doScript('CreateObject("WScript.Shell").Run("URL")'.replace(/URL/, url), ScriptLanguage.VISUAL_BASIC);

    }

}

openURL('creative-scripts.com');

 

HTH

 

Trevor

Votes

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
Participant ,
Oct 16, 2018 Oct 16, 2018

Copy link to clipboard

Copied

LATEST

Well now you're just being EXTRA helpful @Trevor! Many thanks for taking the time to share your updated function.

Cheers

Kal

Votes

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