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

Activating Channels through a for loop

New Here ,
Oct 21, 2013 Oct 21, 2013

Copy link to clipboard

Copied

So basically I am trying to select each of my channels in order and complete a set of tasks on each.  I want to be able to specify which channels are acted on, so I already have an array of my selected channels, but when I try to run the loop, it says that the "activeChannels =" needs an array. 

I know that my channelNumber array is good, but I cant figure out how to make this loop work.

Here is my for loop:

for (var i=0;i<channelNumber.length;i++){

    doc.activeChannels = channelNumber;

    //do some stuff

    }

TOPICS
Actions and scripting

Views

601

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

correct answers 1 Correct answer

New Here , Oct 21, 2013 Oct 21, 2013

I actually just figured it out.  When i declared my channelNumber variable i just declared "channelNumber = new Array(doc.activeChannels)" instead of "channelNumber = doc.activeChannels" and it worked fine.  Seems silly for it not to accept a single channel.

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 21, 2013 Oct 21, 2013

Copy link to clipboard

Copied

Does

    doc.activeChannels = [channelNumber];

work?

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
New Here ,
Oct 21, 2013 Oct 21, 2013

Copy link to clipboard

Copied

I actually just figured it out.  When i declared my channelNumber variable i just declared "channelNumber = new Array(doc.activeChannels)" instead of "channelNumber = doc.activeChannels" and it worked fine.  Seems silly for it not to accept a single channel.

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
Guru ,
Oct 21, 2013 Oct 21, 2013

Copy link to clipboard

Copied

LATEST

Seems silly for it not to accept a single channel.

I guess that depends on how you look at it. It is named activeClannels not activeChannel. And it doesn't really accept multiple channels either. It accepts one argument which must be an array. It is true the array must have valid channel objects as it elements but it accepts one channel the same way it accepts multiple channels - as elements of the array argument.

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