Since I couldn’t find dataStore property of document, I used insert/extractLabel instead. Here is the current version of the script. It stores data with a document and for each user, as you advised me.
Code:try {
var gKasMyDoc = app.activeDocument;
var gKasDocumentName = gKasMyDoc.name;
if (File.fs == "Windows") {
var gKasUserName = $.getenv("USERNAME");
}
else if (File.fs == "Macintosh") {
var gKasUserName = $.getenv("USER");
}
var myLabel = "KasSavedBounds_" + gKasUserName;
} catch(err) {}
if (theItem.eventCode == "docLoaded") {
KasRestoreDocumentsPosition();
}
else if (theItem.eventCode == "docSave") {
KasSaveDocumentsPosition();
}
function KasSaveDocumentsPosition() {
try {
var myCurrentBounds = app.layoutWindows[0].bounds.join(",");
gKasMyDoc.insertLabel(myLabel, myCurrentBounds);
} catch(err) {}
}
function KasRestoreDocumentsPosition() {
var myRestoredBounds = gKasMyDoc.extractLabel(myLabel).split(",");
if (myRestoredBounds != "") {
for (i = 0; i < myRestoredBounds.length; i++) {
myRestoredBounds[i] = parseInt(myRestoredBounds[i]);
}
app.layoutWindows[0].bounds = myRestoredBounds;
}
}
The idea to make such a plug-in came to me when I read, in the Adobe forum, about a problem that appeared in InDesign CS4: unlike CS3, it doesn’t save a document’s position, which irritates some users – I assume there are quite a number of them. I thought it was quite easy to solve this with APID.
I have yet another question: If I want to generate a plug-in for all possible versions — CS, CS2, CS3, CS4, both for Mac and PC, should I have all 8 copies of InDesign installed?