• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
PDF all pages as single pages script. - how to choose (a) document(s)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PDF all pages as single pages script. - how to choose (a) document(s)?


  • Subject: PDF all pages as single pages script. - how to choose (a) document(s)?
  • From: "Patrik B." <email@hidden>
  • Date: Sat, 12 Aug 2006 14:51:59 -0700

Hi,

I put together the below script and now want to add a feature were I can
select a document from a list.

The problem I am running into is how do I refer to the document as the
dialog needs to mention the name of the document but the script needs to
have the document by itself. "Name" is a property of the document. Is there
a way of selecting back? I tried "parent of document with name blabla" but
that does not seem to work.

Also I just added the timeout feature below in two places but was not sure
if that is needed. Do I need to ad it just before the step that takes the
longest or can I just encase the whole script and it will apply 3000 seconds
to each step or the whole thing getting done in 3000 seconds?

Best, Patrik
--------------------------------------------------------------------
Make human rights a reality - first step find out what they are at:
http://www.youthforhumanrights.com/
--------------------------------------------------------------------

--Here is the code of my script were I am trying to add the menu

(*This will pdf each page of each open indesign file*)
set mynamelist to {}
set theRange to "1"
try
	tell application "InDesign CS"
		display dialog "Do you want to pdf all documents or only the
active document." buttons {"All", "Active one"} default button 2 with icon 2
		set exportchoice1 to button returned of result
		set result1 to "Active one"
		if exportchoice1 = result1 then
			set mydocs to active document
			set mydocs2 to name of active document
		else
			set mydocs to documents
			set mydocs2 to name of documents
		end if
		display dialog "Type in the page range or leave all.  Note:
if you select all it will pdf each page as a single pdf." default
answer "All" default button 2 with icon 2
		set exportchoice to text returned of result
		set result2 to "All"
		if (exportchoice = result2) then
			set exportall to true
		else
			set exportall to false
		end if
		set mypathFile to choose folder name with prompt "Choose
export location:"
		set mypathFile to mypathFile as string
		set presetList to name of PDF export presets
		set theChoice to choose from list presetList without
multiple selections allowed and empty selection allowed
		if exportall = true then
			set mydocs to documents
			repeat with i in mydocs -- this is for multiple
documents
				set theName to name of i as text
				set thePath to file path of i as text
				set Mycounter to count of pages in i
				set theRange to 1
				repeat until theRange > Mycounter
					set filePath to mypathFile &
theRange & "-" & theName & ".pdf"
					if theChoice is not false then
						try
							with timeout of 3000
seconds
								set
theDocument to i
								set
thePreset to item 1 of theChoice
								--settings
that are not part of the preset are set in PDF export preference
								set
origRange to page range of PDF export preferences
								set
properties of PDF export preferences to {page range:(theRange as text)}
								with timeout
of 3000 seconds

	export theDocument format PDF type to filePath using PDF export
preset thePreset
									set
page range of PDF export preferences to theRange
								end timeout
								set theRange
to theRange + 1
							end timeout
						end try
					end if
				end repeat
			end repeat
		end if
		if exportall = false then
			repeat with i in mydocs -- this is for multiple
documents
				set theName to name of i as text
				set thePath to file path of i as text
				try
					set text item delimiters to ","
				end try
				set exportchoice3 to text items of
exportchoice
				try
					set text item delimiters to ""
				end try
				log exportchoice3
				try
					repeat with k in exportchoice3
						set filePath to mypathFile &
k & "-" & theName & ".pdf"
						if theChoice is not false
then
							with timeout of 3000
seconds
								set
theDocument to i
								set
thePreset to item 1 of theChoice
								--settings
that are not part of the preset are set in PDF export preference
								set
origRange to page range of PDF export preferences
								set
properties of PDF export preferences to {page range:(k as text)}
								with timeout
of 3000 seconds

	export theDocument format PDF type to filePath using PDF export
preset thePreset
									set
page range of PDF export preferences to k
								end timeout

							end timeout
						end if
					end repeat
				end try
			end repeat
		end if
		try
			set mynamelist to (mydocs2 as text)
		end try
	end tell
end try
try
	set volume 4
	say "Done!."
end try
(**try
	tell application "iChat"
		--send "HELLO" to account "Leo Law"
		send "The pdf'ing of all these documents:
" & (mynamelist as text) & " using " & (thePreset as text) & "
is done." to account "Typesetter"
		close
	end tell
end try

**)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: THANKS: Re: Determining a Paragraph's Index
  • Next by Date: Re: [ANN] Usable Keychain Scripting
  • Previous by thread: THANKS: Re: Determining a Paragraph's Index
  • Next by thread: Re: How to match data in two different text files as fast as possible?
  • Index(es):
    • Date
    • Thread