Copy link to clipboard
Copied
Hello community,
I am really just starting to get my head into javascripting for Adobe products and I seem to get stuck with an idea for Flash and not able to find a solution.
So I would like to ask you three questions:
1. To start the script with: I would like to know the javascript code for automatically set the publish setting (.SWF) without "include hidden layers" option active.
This setting in default is active, but would be enormously helpful if I have this automatically deselected.
2. I would also like to know the javascript code for selecting all layers and keep them all (yellow) active. (Sounds simple to find on the internet to me, but in reality I seem not able to find information).
3. And last; what would be the code if the selection of all layers occurs AFTER opening all folders in Flash's timeline automatically by the script.
Could you help with this?
Thanks in advanced,
Marc
P.s.
It should be replacing the "manual selection part" inside this script:
//Script:
var doc = fl.getDocumentDOM();
var docTimeline = doc.getTimeline();
var exportName;
var layerNum;
var layerSelection = docTimeline.getSelectedLayers();
var layers = new Array();
var count = 0
var moreThanTenLayers = false
var numberLayers = 0
var folder = fl.browseForFolderURL("Choose an output directory");
var docfoldername = doc.name
if (docfoldername.slice (21,22) == "." || docfoldername.slice (21,22) == "_")
{
var exportDest = folder+ "/" +"EXPORT_" + docfoldername.slice (4,21)
}else{
var exportDest = folder+ "/" +"EXPORT_" + docfoldername.slice (4,22)
}
FLfile.createFolder(exportDest)
for ( var it=0;i<layerSelection.length;it++ ) {
var p = docTimeline.layers[layerSelection[it]]
var layerName2 = p.name; //determinate file name
if(layerName2.indexOf("#")>-1){
}
else{
numberLayers = numberLayers + 1
}
if (numberLayers >9){
moreThanTenLayers = true
}
}
for ( var i=0;i<layerSelection.length;i++ )
{
// hide all layers but current
for ( var j=0;j<docTimeline.layerCount;j++ )
{
//only deal with normal visible layers, remember their index
if ( docTimeline.layers
{
layers.push (j);
docTimeline.layers
} else {
docTimeline.layers
}
}
// show layer
var l = docTimeline.layers[layerSelection]
l.visible = true;
var layerName = l.name; //determinate file name
// export only one image if layer is the frame
if (layerName.indexOf("#")>-1){
}
else{
if (layerName.indexOf('CADRE')> -1 || layerName.indexOf('cadre')> -1 || layerName.indexOf('SECU')> -1 || layerName.indexOf('secu')> -1 || layerName.indexOf('BOARD')> -1 || layerName.indexOf('board')> -1 || layerName.indexOf('ANIMATIQUE')> -1)
{
fl.getDocumentDOM().getTimeline().setLayerProperty('layerType', 'normal');
if (moreThanTenLayers = true){
exportName = exportDest + "/" + "000" + "__" + docfoldername.slice (4,18) + layerName
}
else{
exportName = exportDest + "/" + "00" + "__" + docfoldername.slice (4,18) + layerName
}
doc.exportSWF(exportName , true , true);
}
else
{
// padding 0s
if (moreThanTenLayers = true){
var padding = "00"+count
}else{
var padding = "0"+count
}
exportName = exportDest + "/" + padding + "_" + layerName +"_" + docfoldername.slice (4,18);
doc.exportSWF(exportName , true , false);
count += 1;
}
}
l.visible = false;
}
//resets visibility
for ( var i=0;i<docTimeline.layerCount;i++ )
{
docTimeline.layers.visible = true
doc.close(SaveOptions = 0)
}
Copy link to clipboard
Copied
hi,
i didn't read through your code carefully but it looks like you have everything you need. what's the problem you're having with questions 1 and 2? (question 3, i don't understand.)
Copy link to clipboard
Copied
This is what I am actually asking:
In correct order:
1. I want to uncross the active case 'include hidden layer' option purely by running the command (script)
var folder = fl.browseForFolderURL("Choose an output directory");
var docfoldername = doc.name
if (docfoldername.slice (21,22) == "." || docfoldername.slice (21,22) == "_")
{
var exportDest = folder+ "/" +"EXPORT_" + docfoldername.slice (4,21)
}else{
var exportDest = folder+ "/" +"EXPORT_" + docfoldername.slice (4,22)
}
FLfile.createFolder(exportDest)
// var doc = activeDocument;
var layerList = new Array()
getLayers(doc);
for ( var it=0;i<layerSelection.length;it++ ) {
var p = docTimeline.layers[layerSelection[it]]
var layerName2 = p.name; //determinate file name
if(layerName2.indexOf("#")>-1){
}
else{
numberLayers = numberLayers + 1
}
if (numberLayers >9){
moreThanTenLayers = true
}
}
for ( var i=0;i<layerSelection.length;i++ )
{
// hide all layers but current
for ( var j=0;j<docTimeline.layerCount;j++ )
{
//only deal with normal visible layers, remember their index
if ( docTimeline.layers
{
layers.push (j);
docTimeline.layers
} else {
docTimeline.layers
}
}
// show layer
var l = docTimeline.layers[layerSelection]
l.visible = true;
var layerName = l.name; //determinate file name
// export only one image if layer is the frame
if (layerName.indexOf("#")>-1){
}
else{
if (layerName.indexOf('CADRE')> -1 || layerName.indexOf('cadre')> -1 || layerName.indexOf('SECU')> -1 || layerName.indexOf('secu')> -1 || layerName.indexOf('BOARD')> -1 || layerName.indexOf('board')> -1 || layerName.indexOf('ANIMATIQUE')> -1)
{
fl.getDocumentDOM().getTimeline().setLayerProperty('layerType', 'normal');
if (moreThanTenLayers = true){
exportName = exportDest + "/" + "000" + "__" + docfoldername.slice (4,18) + layerName
}
else{
exportName = exportDest + "/" + "00" + "__" + docfoldername.slice (4,18) + layerName
}
doc.exportSWF(exportName , true , true);
}
else
{
// padding 0s
if (moreThanTenLayers = true){
var padding = "00"+count
}else{
var padding = "0"+count
}
exportName = exportDest + "/" + padding + "_" + layerName +"_" + docfoldername.slice (4,18);
doc.exportSWF(exportName , true , false);
count += 1;
}
}
l.visible = false;
}
//resets visibility
for ( var i=0;i<docTimeline.layerCount;i++ )
{
docTimeline.layers.visible = true
doc.close(SaveOptions = 0)
}
2. I would like to let the script open all folders on the timeline
3. I would like that the script selects all layers
then run:
Copy link to clipboard
Copied
Sorry, I messed up the order in the text.
I mean:
This is what I am actually asking:
In correct order:
1. I want to uncross the active case 'include hidden layer' option purely by running the command (script)
2. I would like to let the script open all folders on the timeline
3. I would like that the script selects all layers
...then run the script.
Marc
Find more inspiration, events, and resources on the new Adobe Community
Explore Now