Skip to main content
Inspiring
February 4, 2019
Answered

Check if the selection exists with suspendHistory function

  • February 4, 2019
  • 1 reply
  • 1184 views

Hi,

Does anyone have any other way to check if the selection exists?

This doesnt work using with the suspendHistory() function.

Always return false.

function detectSelection() {

var doc = app.activeDocument

var res = false;

var as = doc.activeHistoryState;

doc.selection.deselect();

if (as != doc.activeHistoryState) {

res = true;

doc.activeHistoryState = as;

}

return res;

};

function main(){

    alert("Selection: " + detectSelection())

    }

app.activeDocument.suspendHistory("CheckingSelection", "main()")

//main() //return true if executing after suspendHistory() withoutactive selection.

This topic has been closed for replies.
Correct answer r-bin

Re: Warning active selection

1 reply

r-binCorrect answer
Legend
February 4, 2019
Inspiring
February 4, 2019

Thanks, I cant find anything here with this searchbox.

Participant
November 20, 2019

What was the answer? The link is broken.