Copy link to clipboard
Copied
Hello I have created a dialog for the Photoshop script and in this dialog there is a static text that is the url of some web page. Here I have used Adobe forum url as an example. Is it possible to make it clickable and open that url in the web browser. I am aware that if this is the plugin, this is psosible. But I am using Script UI to create thsi dialog, so is it possible to make clickable link in Photoshop?
Here is the code
function showDialog() {
var obj = {};
var dlg = new Window("dialog", "Sample");
row = dlg.add('group', undefined, '');
row.add('statictext', undefined, "Path: ");
var pathInput = row.add('edittext', undefined, "");
pathInput.enabled = false;
pathInput.preferredSize = [350, 22];
//Icon button
var selectButton = row.add('button', undefined, 'Select', {
name: 'Select'
});
selectButton.onClick = function () {
var folderPath = Folder.selectDialog("Select a folder to save the files");
if (folderPath) {
pathInput.text = decodeURI(folderPath.fsName);
goButton.enabled = true;
}
};
var checkBoxGroup;
checkBoxGroup = dlg.add('group', undefined, '');
checkBoxGroup.alignment = "left";
checkBoxGroup.orientation = 'column';
checkBoxGroup.alignChildren = "left";
checkBoxGroup.margins.left = 25;
var buttonGroup = dlg.add('group', undefined, '');
buttonGroup.alignment = 'right';
var cancelButton = buttonGroup.add('button', undefined, 'Cancel', {
name: 'Cancel'
});
cancelButton.onClick = function () {
dlg.close();
};
var goButton = buttonGroup.add('button', undefined, 'Go', {
name: 'Go'
});
goButton.onClick = function () {
// Some other tasks
dlg.close();
}
if (pathInput.text == '') {
goButton.enabled = false;
}
info = dlg.add('group', undefined, '');
info.alignChildren = 'left'
var version = info.add('statictext', undefined, "Version: 1.1 ");
version.preferredSize = [350, 15];
var website = info.add('statictext', undefined, "https://community.adobe.com/");
website.preferredSize = [200, 15];
dlg.show();
}
showDialog();
Also, attached image to give clear explanantion. Please let me know whether is it possible to do using Script UI in photoshop or not? If yes, Please share any references.
Thanks in advance
1 Correct answer
A Script UI button on click function can do something to open a url in the user's default browse just through a html file over the wall to the user's OS. The file should be associated with the user's default browser. That is what my Script dialog Help buttons do.
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.
...
Explore related tutorials & articles
Copy link to clipboard
Copied
This link is for InDesign, however I'm guessing that it will also be workable in Photoshop.
Copy link to clipboard
Copied
Thankyou Stephen. I have gone through this link earlier as well, but unfortunately app.doScript does not exists for Photoshop.
Thanks
Charu
Copy link to clipboard
Copied
.png you attached just reopen same page in new window.
As to your question you probably can only make button.
Copy link to clipboard
Copied
using .addEventListener ('click', ...), we can do click processing for statictext. If add an underline and color the text, then we get something that looks like a link. Link processing can most likely be done by calling an external script
Copy link to clipboard
Copied
A Script UI button on click function can do something to open a url in the user's default browse just through a html file over the wall to the user's OS. The file should be associated with the user's default browser. That is what my Script dialog Help buttons do.
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.");
};
}
Copy link to clipboard
Copied
Thankyou JJMark. This help to implement what I needed.
Thanks to all community members here.
Best regards
Charu
Copy link to clipboard
Copied
I'm Mark. He is Mack 😉
Copy link to clipboard
Copied
For some reason, concatenating a String and an Object is throwing an error for me.
So, I guess the best practice is to transform the folder into String before joining:
var URL = new File(Folder.temp.toString() + "/PhotoCollageToolkit.html");
thanks for this great piece of code!
Copy link to clipboard
Copied
No error for me without .toString().
Could you place that in Try..Catch statement and say what type of error?
Copy link to clipboard
Copied
I get this error: "Object of type Folder found where a Number, Array, or Property is needed".
Only when running the script targeting After Effects. If I target ExtendScript Toolkit CS5, there's no error.
Copy link to clipboard
Copied
The code was posted for Photoshop scripting you seem to have adapted it for use with After effects scripting as well...... I first use it in CS2 and it still works in Photoshop 2021 version 22.5. I just hack at scripting Photoshop I do not know JavaScript. To know when ".toString()" should be use I my try that if a hack fails on me.
Copy link to clipboard
Copied
Why AE if we're in Ps forum? It works for me as well with sole ESTK CC as with targeted Ps.
Copy link to clipboard
Copied
yep, sorry, I didnt notice I was in a PS forum.
anyway, anyone who write scripts for more than one software, may take some insight in this thread.

