2
Community Beginner
,
/t5/photoshop-ecosystem-discussions/link-to-webpage-in-statictext-control-in-ui-in-jsx-script/td-p/14435069
Feb 20, 2024
Feb 20, 2024
Copy link to clipboard
Copied
Hello, Everybody!
Is it possible, to make link to webpage in staticText control in UI in JSX-script?
Here is an example of the code. I need to modify it to make link active.
var dlgResource = "dialog {\
text : 'Link To Adobe in Static Text Control',\
\
stTextQuestion : StaticText{\
text : 'how can I turn the following text into an active link?',\
justify: 'left'\
}\
\
stTextLink : StaticText{\
text : 'www.adobe.com',\
justify: 'center'\
}\
\
}"
var dlgWithLink = new Window(dlgResource);
dlgWithLink.center();
dlgWithLink.show();
TOPICS
Actions and scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Enthusiast
,
Feb 21, 2024
Feb 21, 2024
This is what you need,
make good use of it
//Made Ciccillotto
main()
function main() {
var docRef = app.activeDocument;
var myWindow = new Window ("dialog", "Link To Adobe in Static Text Control", undefined, {closeButton: true});
var myLText = myWindow.add ("statictext", undefined, "how can I turn the following text into an active link?");
var scriptFolder = new File(WhoAmI()).parent;
var myLink = myWindow.add ("statictext", undefined, "link open adobe");
myLink.graphics.foregroundColor
...
Explore related tutorials & articles
Enthusiast
,
/t5/photoshop-ecosystem-discussions/link-to-webpage-in-statictext-control-in-ui-in-jsx-script/m-p/14436915#M781149
Feb 21, 2024
Feb 21, 2024
Copy link to clipboard
Copied
This is what you need,
make good use of it
//Made Ciccillotto
main()
function main() {
var docRef = app.activeDocument;
var myWindow = new Window ("dialog", "Link To Adobe in Static Text Control", undefined, {closeButton: true});
var myLText = myWindow.add ("statictext", undefined, "how can I turn the following text into an active link?");
var scriptFolder = new File(WhoAmI()).parent;
var myLink = myWindow.add ("statictext", undefined, "link open adobe");
myLink.graphics.foregroundColor = myLink.graphics.newPen (myWindow.graphics.PenType.SOLID_COLOR, [1.00, 0.255, 0.255, 1],lineWidth=1);
myLink.onClick = function () {
openInBrowser("http://www.adobe.com/");
}
myWindow.show ()
} // end of function main
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
function openInBrowser(/*str*/ url) {
var isMac = (File.fs == "Macintosh"),
fName = 'tmp' + (+new Date()) + (isMac ? '.webloc' : '.url'),
fCode = isMac ?
('<?xml version="1.0" encoding="UTF-8"?>\r'+
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" '+
'"http://www.apple.com/DTDs/PropertyList-1.0.dtd">\r'+
'<plist version="1.0">\r'+
'<dict>\r'+
'\t<key>URL</key>\r'+
'\t<string>%url%</string>\r'+
'</dict>\r'+
'</plist>') :
'[InternetShortcut]\rURL=%url%\r';
var f = new File(Folder.temp.absoluteURI + '/' + fName);
if(! f.open('w') ) return false;
f.write(fCode.replace('%url%',url));
f.close();
f.execute();
$.sleep(500);
f.remove();
return true;
}
function WhoAmI() {
var where;
try {
var FORCEERROR = FORCERRROR;
}
catch( err ) {
where = File(err.fileName);
}
return where;
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Alex Rezvov
AUTHOR
Community Beginner
,
LATEST
/t5/photoshop-ecosystem-discussions/link-to-webpage-in-statictext-control-in-ui-in-jsx-script/m-p/14437044#M781156
Feb 21, 2024
Feb 21, 2024
Copy link to clipboard
Copied
Great Thank's! It work!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

