Copy link to clipboard
Copied
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.
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you very much Davide and JJMack
I´ll try this way
Best Regards
Gustavo
Copy link to clipboard
Copied
Thanks also, saved my day
Find more inspiration, events, and resources on the new Adobe Community
Explore Now