sort to individual folder 1.0b
Posted: May 14th, 2012, 10:03 am
hey all,
I have written a new (simple) script. The purpose of this script is to take selected items in your project window and place them in their own folder named after themselves.
It available on http://vidjuheffex.com/scripts/
I had an issue with the first uploaded version of the script:
this seemed to be working in CS5.5 (windows 7 64bit) but when I came to work (CS5 boxes) selecting layers and clicking the script would always launch the alert box, the user would have to click it like 20 times and then the script would work?
The current solution is:
The obvious difference is that there are no alerts anymore, I also added an '==' comparison to the first 'for' loop (this was what I thought would fix the bug but when I had this and the else{} it was still bugging out.) I left it in since otherwise no comparison was being made.
How can I get the alerts back, I think I've pin pointed where the problem is, just not the solution. Any help would be greatly appreciated thanks!
I have written a new (simple) script. The purpose of this script is to take selected items in your project window and place them in their own folder named after themselves.
It available on http://vidjuheffex.com/scripts/
I had an issue with the first uploaded version of the script:
Code: Select all
app.beginUndoGroup("Sort To Individual Folders");
var mySelectedItems = [];
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i).selected){
mySelectedItems[mySelectedItems.length] = app.project.item(i);
}
else{
alert("Please select an item(s) in the project bin!");
break;
};
}
for (var i = 0; i < mySelectedItems.length; i++){
var mySelection = mySelectedItems[i];
var compFolder = app.project.items.addFolder(mySelection.name);
mySelection.parentFolder = compFolder;
}
app.endUndoGroup;
The current solution is:
Code: Select all
app.beginUndoGroup("Sort To Individual Folders");
var mySelectedItems = [];
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i).selected === true){
mySelectedItems[mySelectedItems.length] = app.project.item(i);
};
}
for (var i = 0; i < mySelectedItems.length; i++){
var mySelection = mySelectedItems[i];
var compFolder = app.project.items.addFolder(mySelection.name);
mySelection.parentFolder = compFolder;
}
app.endUndoGroup;
How can I get the alerts back, I think I've pin pointed where the problem is, just not the solution. Any help would be greatly appreciated thanks!