Query available Layer Comps in a file

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Query available Layer Comps in a file

Post by ernpchan »

Is there a way to get the list of Layer Comps that are in a file?
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Query available Layer Comps in a file

Post by dkwroot »

I haven't tested this code, but I believe it goes something like this...

Code: Select all

Doc = moho.document
for i in Doc:CountLayerComps()-1 do
   Comp = Doc:GetLayerComp(i)
   print(Comp:Name())
end
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Re: Query available Layer Comps in a file

Post by ernpchan »

Eh, after seeing this was in the MohoDoc section in aslua.com I shoulda been able to figure this out. :oops:

I gotta get my head wrapped around lua/ASP's scripting doc to avoid such noob questions.

Thx dkwroot.
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
ernpchan
Posts: 154
Joined: Thu Aug 13, 2015 7:18 pm
Contact:

Re: Query available Layer Comps in a file

Post by ernpchan »

Just in case others ask, this is the proper syntax.

Code: Select all

    Doc = moho.document
    for i = 0, Doc:CountLayerComps()-1 do
        Comp = Doc:GetLayerComp(i)
        print(Comp:Name())
    end
My opinions and comments do not represent those of my employer.
http://www.ernestpchan.com
http://www.zazzle.com/gopuggo
User avatar
hayasidist
Posts: 3500
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Query available Layer Comps in a file

Post by hayasidist »

Thanks guys -- ASLua updated with this info.
Post Reply