Thank you very much for your reply, i tried it and no errors but not working!
//Unanchored all Anchored Objects at Once
//Check if a Document is Open
if (app.documents.length == 0) {
alert ("No document is open.", "Caution");
exit();
}
//Working in the Current Active Document
var myDoc = app.activeDocument;
// to use to process entire document
var myItems = myDoc.allPageItems;
//Creating Founded Objects Array
var foundObjects = Array();
for(var i = 0; i < myItems.length; i++){
if(myItems[i].parent instanceof Character){foundObjects.push(myItems[i]);}
}
//Check if Anchored Objects not Found
if ( myItems.length == 0 )
{
alert("No Anchored items found in this document!.", "Stop" );
exit();
}
//UnAnchored Process Started at Array Created
if(foundObjects.length > 0){
for(var i = 0; i < foundObjects.length; i++){
if (foundObjects[i].appliedObjectStyle == "ObjStyle") {
foundObjects[i].anchoredObjectSettings.anchoredPosition = AnchorPosition.anchored;
var AnchoredObject = foundObjects[i].anchoredObjectSettings.releaseAnchoredObject();
}
}
}
//Check if the Program is Done
if (AnchoredObject < 0) {
alert ("all Objects Done.", "Stop");
exit();
}
Sorry it should be if foundObjects[i].appliedObjectStyle.name == "ObjStyle"
Or,
if (foundObjects [i].appliedObjectStyle == myDoc.objectStyles.itemByName("ObjStyle")