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.
Can this link be directly placed as a hyperlink in the palette?
Just wondering...
Cheers
Roy
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
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
Copy link to clipboard
Copied
Nice. Thanks for that. Works a treat! (and thanks Harbs too)
Roy
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
Copy link to clipboard
Copied
Well now you're just being EXTRA helpful @Trevor! Many thanks for taking the time to share your updated function.
Cheers
Kal