Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: Re: Switch Layers Script Question

$
0
0

I've removed line 29 so the selection isn't index0 and replaced it with the variable that I defined at the top of the script ( var Current = app.activeDocument; ) Problem is now it's throwing me another error message. It says that the current document (whatever its name may be in Photohop) is not a list index or listitem... This is close but I can't figure out where it's going wrong. The fact that the error message is now referencing my active document is a good sign but I'm still trying to successfully achieve this

 

 

var aDoc = app.activeDocument; 
var AllDocs = app.documents; 
var actLay = aDoc.activeLayer; 
var Current = app.activeDocument;

if (AllDocs.length > 1) { 
var itemDoc = null; 


var win = new Window("dialog","Switch


Documents"); 
this.windowRef = win; 
win.Txt1 = win.add ("statictext", undefined,


"Switch to which document?"); 
win.NewList=win.add ("dropdownlist",


undefined) 
for (var m = 0; m < AllDocs.length; m++) { 
win.NewList.add("item", AllDocs[m].name)  
} 


{win.NewList.selection = Current}



itemDoc = win.NewList.selection.actLay; 

win.cancelBtn = win.add("button", undefined,


"Switch"); 


win.cancelElement = win.cancelBtn; 



win.NewList.onChange= function () {     itemDoc = win.NewList.selection.index;     return itemDoc;     } 

win.show(); 

app.activeDocument = app.documents[itemDoc]; 

app.refresh(); 
} 

Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>