Question
Problem using thumbnail moveTo() method
(I would swear that I posted this message yesterday, but it doesn't show up so I am trying again.)
I am adding a context menu item for thumbnails to move allow me to move selected thumbnails to another location, creating the new location if necessary. The script is creating the new directory correctly but moveTo(newDirectory) is always failing. I presume I am doing something wrong, but don't know what it is. I would appreciate any guidance.
cntCommand.onSelect = function(m)
{
app.synchronousMode = true; // This doesn't help
$.writeln("onSelect entered");
var thumb = app.document.thumbnail;
var targetDir = CreateSubFolder(thumb, "Rejects");
$.writeln("Target directory is: " + targetDir);
var targetThumb = new Thumbnail (targetDir);
// Also tried moveTo(targetDir) with same failure
if (!thumb.moveTo (targetThumb)) {
$.writeln("moveTo failed");
}
};
function CreateSubFolder( doc, folderName ) {
$.writeln("CreateSubFolder entered");
var imgPath = doc.path
var dirName = imgPath + "/" + folderName
var targetDir = new Folder(dirName)
$.writeln("CreateSubFolder: " + dirName);
if (!targetDir.exists) {
targetDir.create();
}
return targetDir;
}
I am adding a context menu item for thumbnails to move allow me to move selected thumbnails to another location, creating the new location if necessary. The script is creating the new directory correctly but moveTo(newDirectory) is always failing. I presume I am doing something wrong, but don't know what it is. I would appreciate any guidance.
cntCommand.onSelect = function(m)
{
app.synchronousMode = true; // This doesn't help
$.writeln("onSelect entered");
var thumb = app.document.thumbnail;
var targetDir = CreateSubFolder(thumb, "Rejects");
$.writeln("Target directory is: " + targetDir);
var targetThumb = new Thumbnail (targetDir);
// Also tried moveTo(targetDir) with same failure
if (!thumb.moveTo (targetThumb)) {
$.writeln("moveTo failed");
}
};
function CreateSubFolder( doc, folderName ) {
$.writeln("CreateSubFolder entered");
var imgPath = doc.path
var dirName = imgPath + "/" + folderName
var targetDir = new Folder(dirName)
$.writeln("CreateSubFolder: " + dirName);
if (!targetDir.exists) {
targetDir.create();
}
return targetDir;
}
