// (c) Copyright 2014 Adobe Systems, Inc. All rights reserved.

var out = 0;
if (app.activeDocument) {
    out = app.activeDocument.id;
}
out