I'm trying to advance the Date Modified of each selected file by 1 minute (so that it will be synced):
var oFSO = new ActiveXObject ("Scripting.FileSystemObject")
var eSelected = new Enumerator (ClickData.func.sourcetab.selected)
eSelected.moveFirst ()
while (!eSelected.atEnd ()) {
oItem = eSelected.item ()
var dItemDate = oItem.modify
DOpus.Output ("The previous date modified is: " + dItemDate)
dItemDate = new Date (dItemDate + 60000)
DOpus.Output ("The new date last modified is: " + dItemDate)
// ?????????????
eSelected.moveNext ()
}The entry in the manual seems to indicate that the missing lines should end with
oItem.SetTime (dItemDate) but after much searching and experimenting, I can't work it out. I assume that I am not opening the file properly before issuing this command, but I been unsuccessful here, despite having read carefully the account in the manual.
Reading quickly over the Item and File objects, I'd say try something like this:
var file = item.Open(, "m");
var newDate = new Date(item.modify_utc + 60000); //probably not the correct way
file.SetTimeUTC( newDate.getTime() );
file.Close();
I guess you need to lookup how to correctly create a date object, that is 1 minute ahead of the utc date from item.modify_utc.
Then pull the date in utc format out of that new date object and use it in file.SetTimeUTC().
I thought the same, but somehow was not able to find an evidence in the docs, my buttons or scripts. Mhh.. o)
Can you give another hint on which command and switch to use? I guess it's SetAttr META ?
Thanks very much, tbone and jon. I've ended up doing it by the built-in DOpus method — I had found this manual page before, but I had inexcusably missed the very simple point that it can be applied only to one file and not to all selected files.
Jon, you may want to look at the scripting part of the Manual under 'Item' and 'File' about opening files, changing attributes and so forth. Some procedures there differ from standard JScript, so that it's harder to get help on the web. The pages may need expanding with example code snippets for people not skilled in this stuff and stumbling about doing silly things.