🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2576

Re: New CS4 features

#2576
From: jongware
Date: Thu, 11 Dec 2008 10:04
97 lines
2590 bytes
Noel, nothing wrong with Roy's posts for me (using the default web interface). It may just be you :-)

Talking about interfaces, please don't comment on this one. It does the job, innit? (I'm sure someone else could do better with ScriptUI. Go ahead.)



var myStyleList = new Array;

for(c = 1; c < app.activeDocument.paragraphStyles.length; c++)

{

	if (app.activeDocument.paragraphStyles.item(c).otfStylisticAlternate == true)

		name = "[+] ";

	else

		name = "[-] ";

	name += app.activeDocument.paragraphStyles.item(c).name;

	myStyleList.push(name);

}

var myCharsList = new Array;

for(c = 1; c < app.activeDocument.characterStyles.length; c++)

{

	if (app.activeDocument.characterStyles.item(c).otfStylisticAlternate == true)

		name = "[+] ";

	else

		name = "[-] ";

	name += app.activeDocument.characterStyles.item(c).name;

	myCharsList.push (name);

}

var parDialog = app.dialogs.add({name:"Salt your Styles",canCancel:true});

with(parDialog)

{

	with(dialogColumns.add())

	{

		with(dialogRows.add())

		{

			parCheck = checkboxControls.add({staticLabel:"Paragraph style"});

			parDropdown = dropdowns.add({stringList:myStyleList, selectedIndex:0});

		}

		with(dialogRows.add())

		{

			charCheck = checkboxControls.add({staticLabel:"Character style"});

			charDropdown = dropdowns.add({stringList:myCharsList, selectedIndex:0});

		}

	}

}

var result = parDialog.show();

if (result)

{

		if (parCheck.checkedState)

			app.activeDocument.paragraphStyles.item(parDropdown.selectedIndex+1).otfStylisticAlternate = !app.activeDocument.paragraphStyles.item(parDropdown.selectedIndex+1).otfStylisticAlternate;

		if (charCheck.checkedState)

			app.activeDocument.characterStyles.item(charDropdown.selectedIndex+1).otfStylisticAlternate = !app.activeDocument.characterStyles.item(charDropdown.selectedIndex+1).otfStylisticAlternate;

}

parDialog.destroy();
Technical Details
Message-ID: <59b6c94b.16@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <8CA81AB15580A6E9CCA84A744480F39D@in.webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,708f7b31553c0113
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: jongware@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: New CS4 features
Message-ID: <59b6c94b.16@webcrossing.la2eafNXanI>
Date: Thu, 11 Dec 2008 02:04:38 -0800
References: <8CA81AB15580A6E9CCA84A744480F39D@in.webcrossing.la2eafNXanI>
Lines: 107
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit