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

Hyperlink in the scripts's UI

Advocate ,
Sep 13, 2013 Sep 13, 2013

Hi friends

I was looking in the JavaScript Tools guide but did not find this information (or perhaps I missed it). Would it be possible to a statictext become a hyperlink? And a portion of a text in an alert pop-up? For example:

var dlg = new Window ("dialog", "My dialog", undefined);

var myText = dlg.add ("statictext", undefined, "www.mysite.com");

var myButton = dlg.add ("button", undefined, "Click here");

myButton.onClick = function (){

alert("Please visit www.mysite.com for more informations, or send e-mail to me@mysite.com.");

};

dlg.show();

Could the "www.mysite.com" in the statictext and alert be an hyperlink? The same for the e-mail "me@mysite.com"? Does JavaScript UI allows it?

Thank you very much

Gustavo.

TOPICS
Actions and scripting
1.4K
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

correct answers 1 Correct answer

Advocate , Sep 13, 2013 Sep 13, 2013

Gustavo,

as far as I know that's not possible within an Alert. But if you resort to popping up a dialog, you can attach an eventListener like this one:

dlg.myText.addEventListener('click', (function() {

  var fname, shortcut;

  fname = "_shortcut.url";

  shortcut = new File("" + Folder.temp + "/" + fname);

  shortcut.open("w");

  shortcut.writeln("[InternetShortcut]");

  shortcut.writeln("URL=http://www.mywebsite.com");

  shortcut.writeln();

  shortcut.close();

  shortcut.execute();

  $.sleep(4000);

  return

...
Translate
Adobe
Advocate ,
Sep 13, 2013 Sep 13, 2013

Gustavo,

as far as I know that's not possible within an Alert. But if you resort to popping up a dialog, you can attach an eventListener like this one:

dlg.myText.addEventListener('click', (function() {

  var fname, shortcut;

  fname = "_shortcut.url";

  shortcut = new File("" + Folder.temp + "/" + fname);

  shortcut.open("w");

  shortcut.writeln("[InternetShortcut]");

  shortcut.writeln("URL=http://www.mywebsite.com");

  shortcut.writeln();

  shortcut.close();

  shortcut.execute();

  $.sleep(4000);

  return shortcut.remove();

}), false);

Not very much elegant I know, but it works 😉

Cheers,

Davide Barranca

www.davidebarranca.com

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
Community Expert ,
Sep 13, 2013 Sep 13, 2013

You can also write an html file and execute it. The users default browser should start.  In that html file you can redirect the browser to your web site where your help is maintained and perhaps in there is a mail to html tag and a download link to the latest version. Here is what my help dialog button does.

function help() {

          try{

                    var URL = new File(Folder.temp + "/PhotoCollageToolkit.html");

                    URL.open("w");

                    URL.writeln('<html><HEAD><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.mouseprints.net/old/dpr/PhotoCollageToolkit.html"></HEAD></HTML>');

                    URL.close();

                    URL.execute();

          }catch(e){

                    alert("Error, Can Not Open.");

          };

}

You could keep the html code local so no internet connection is required. Where the html includes your alert text and has a mail to tag. The Script keeps running is not stopped by the alert and a browser windows opens.

JJMack
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
Advocate ,
Sep 16, 2013 Sep 16, 2013

Thank you very much Davide and JJMack

I´ll try this way

Best Regards

Gustavo

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
Enthusiast ,
Oct 03, 2014 Oct 03, 2014
LATEST

Thanks also, saved my day

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