• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[Javascript] Opening two images, and loading channels from one to the other. Works at home on PC, but not on MAC at work.

New Here ,
Oct 18, 2015 Oct 18, 2015

Copy link to clipboard

Copied

Okay so, it works perfectly fine on my PC at home, but when I load the script at work (On a Mac) it gets up to the point where it opens the two images, but then at the LOAD SELECTION part, it won't recognize that there are two images open and let me load from the other one.

Even stopping the script at that point and trying to select LOAD SELECTION won't work. If I open them manually (Without a script) it seems to recognize things fine and give me the load selection option, so I am confused as to what exactly is going on. Are the images just opening up too quickly and PS is freaking out or something?

TOPICS
Actions and scripting

Views

224

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Engaged ,
Oct 18, 2015 Oct 18, 2015

Copy link to clipboard

Copied

LATEST

Hi jimmy,

Please find the code...

if(app.documents.length>1){

    var docRef = app.activeDocument

    var channelIndex = 0

    var visibleChannelCount = 0

    switch (docRef.mode) {

        case DocumentMode.BITMAP:

        case DocumentMode.GRAYSCALE:

        case DocumentMode.INDEXEDCOLOR:

        visibleChannelCount = 1

        break;

        case DocumentMode.DUOTONE:

        visibleChannelCount = 2

        break;

        case DocumentMode.RGB:

        case DocumentMode.LAB:

        visibleChannelCount = 3

        break;

        case DocumentMode.CMYK:

        visibleChannelCount = 4

        break;

        case DocumentMode.DUOTONE:

        visibleChannelCount = 4

        break;

        case DocumentMode.MULTICHANNEL:

        default:

        visibleChannelCount = inDocument.channels.length + 1

        break;

    }

var activeChannels = app.activeDocument.activeChannels;

var myChannels = docRef.channels;

var selAlpha;

var Fname=prompt("Enter the File Name with extension...!","","Do Smart") // With extension ex: Sample.psd

//Make sure both document are same pixel dimention.!!!

if(Fname!="") {

    for (var channelIndex = visibleChannelCount; channelIndex < myChannels.length; channelIndex++) {

            selAlpha=docRef.channels.getByName(myChannels[channelIndex].name);

            theCopy=app.documents.getByName(Fname);

            selAlpha.duplicate(theCopy);

          }//For Loop

    } //IF lopp

}//Main loop


					
				
			
			
				
			
			
			
			
			
			
			
		

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines