🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #10292

Re: Display Dialog question

#10292
From: Kari Puikkonen
Date: Fri, 30 Jun 2006 08:24
59 lines
2553 bytes
Shane,

You were right, the search method is way to go.

Thank you for your valuable time!

Here is the final script for those who have followed this thread:

-- Change Case of Selected Paragraph.scpt 
tell application "Adobe InDesign CS2" 
	set myDoc to active document

	set myParaList to name of every paragraph style of myDoc 
	set myCaseVals to {lowercase, sentencecase, titlecase, uppercase}

	set AppleScript's text item delimiters to "+" 
	set myCaseList to text items of (myCaseVals as string) 
	set AppleScript's text item delimiters to ""

	set myDialog to make dialog with properties {name:"Choose paragraph style and change case"} 
	tell myDialog 
		tell (make dialog column) 
			tell (make border panel) 
				tell (make dialog column) 
					make static text with properties {static label:"Choose a paragraph style to affect", min width:150} 
				end tell 
				tell (make dialog column) 
					set myPresetsDropdown to make dropdown with properties � 
						{string list:myParaList, selected index:0, min width:150} 
				end tell 
				tell (make dialog column) 
					make static text with properties {static label:"Choose a case", min width:150} 
				end tell 
				tell (make dialog column) 
					set myCaseDropdown to make dropdown with properties � 
						{string list:myCaseList, selected index:0} 
				end tell 
			end tell 
		end tell 
	end tell 
	set myResult to show myDialog 
	if myResult = true then 
		--+1 gets the correct name because list starts at 0 
		set myPara to item ((selected index of myPresetsDropdown) + 1) of myParaList 
		set myCase to item ((selected index of myCaseDropdown) + 1) of myCaseVals 
	end if 
	destroy myDialog

	tell myDoc 
		set myStyle to paragraph style myPara 
		set myChange to search with find attributes {applied paragraph style:myStyle} 
		changecase myChange using myCase 
	end tell

end tell



Kari
Technical Details
Message-ID: <3bc0ad4b.20@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossing
References: <3bc0ad4b.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,ea7bd79cbe57db77
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII
From: "Kari Puikkonen" <kari.puikkonen@welho.com>
Newsgroups: adobe.scripting.indesign
Subject: Re: Display Dialog question
Message-ID: <3bc0ad4b.20@webcrossing.la2eafNXanI>
Date: Fri, 30 Jun 2006 01:24:25 -0700
References: <3bc0ad4b.-1@webcrossing.la2eafNXanI>
Lines: 62
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossing