Legend
March 31, 2026
Answered
After running the function, how can I ensure that only a specific object remains selected?
- March 31, 2026
- 4 replies
- 54 views
Currently, I have selected an image and a text frame.
I want only the image to remain selected after the function executes.
Here is the code:
I want only the selected image to remain after executing “exit();”.
Thank you very much.
var doc = app.activeDocument;
var item = doc.selection[0];
var items = doc.selection;
if (items.length > 1) {
var sel = items;
tx = 0
for (i = 0; i < sel.length; i++) {
if ('TextFrame' == sel[i].constructor.name) {
tx = sel[i];
}
if ('TextFrame' != sel[i].constructor.name) {
ob = sel[i]
}
}
if (tx != 0) {
getA();
exit();
}
}
function getA() {
var a = 2 + 3;
}

