Query available Layer Comps in a file

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

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, 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 » Tue Oct 20, 2015 7:17 pm

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: 659
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Query available Layer Comps in a file

Post by dkwroot » Tue Oct 20, 2015 11:43 pm

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 » Wed Oct 21, 2015 12:11 am

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 » Wed Oct 21, 2015 12:21 am

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
hayasidist
Posts: 2123
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Query available Layer Comps in a file

Post by hayasidist » Wed Oct 21, 2015 10:43 am

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