Check if the selection exists with suspendHistory function
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.