Re: Brain Function
Re: Brain Function
- Subject: Re: Brain Function
- From: Graff <email@hidden>
- Date: Tue, 13 Apr 2004 21:10:23 -0400
Here's a script to do something like this. It uses the command-line
tool lpr to print the odd pages and then the even ones. It even counts
up the pages and runs a dialog so you can choose what pages to print.
Because the lines may have been wrapped when you get it with your
e-mail client I've preceded each line with 4 spaces. Any line that
doesn't have 4 spaces at the start belongs with the line above it. If
the script doesn't come through all right then e-mail me directly and
I'll send it to you as a file.
--------
set theFile to choose file of type {"PDF "}
set posixFile to quoted form of POSIX path of theFile
set addPath to "export PATH=${PATH}:/usr/local/bin"
set numPages to do shell script addPath & ";pdf2ps -sOutputFile=- "
& posixFile & " | grep -c '%%Page: '"
set firstPage to 1
set lastPage to numPages
set choiceIsDone to false
repeat while choiceIsDone is false
try
set theAnswer to display dialog "Choose starting page number (1
- " & numPages & ")" default answer (firstPage as text)
set numAnswer to ((text returned of theAnswer) as number)
if ((numAnswer >= 0) and (numAnswer <= numPages)) then
set firstPage to numAnswer
set choiceIsDone to true
end if
end try
if choiceIsDone is false then
display dialog "You must enter in a number from 1 to " &
numPages
end if
end repeat
set choiceIsDone to false
repeat while choiceIsDone is false
try
set theAnswer to display dialog "Choose ending page number (" &
firstPage & " - " & numPages & ")" default answer (numPages as text)
set numAnswer to ((text returned of theAnswer) as number)
if ((numAnswer >= firstPage) and (numAnswer <= numPages)) then
set lastPage to numAnswer
set choiceIsDone to true
end if
end try
if choiceIsDone is false then
display dialog "You must enter in a number from " & firstPage &
" to " & numPages
end if
end repeat
do shell script "lpr -o page-ranges=" & firstPage & "-" & lastPage
& " -o page-set=odd " & posixFile
do shell script "lpr -o page-ranges=" & firstPage & "-" & lastPage
& " -o page-set=even " & posixFile
--------
- Ken
On Apr 13, 2004, at 5:36 PM, Chris Espinosa wrote:
If there's anybody with expertise on scripting printing in Acrobat or
Preview that could help this person, I'd be obliged.
Chris
Begin forwarded message:
From: Larry Walker <email@hidden>
Date: April 13, 2004 12:06:12 PM PDT
To: email@hidden
Subject: Brain Function
Hello;
My name is Larry Walker. I am a Macintosh computer user.
I need help with using AppleScript.
I have read Danny Goodman's AppleScript book on AppleScript. I have
done all the exercises with the book as well as the tutorial exercises
that Apple has. But I have still not been able to make my own script.
I am mentally disabled. I guess I am beginning to realize my
limitations. In 1999 I nearly died from meningitis. Over the last
several years I have been finding how much brain damage actually
occurred.
Here is an example of what I want to be able to have an AppleScript
do. I have a acrobat file that I want to print several pages but not
all the pages as it is a huge 1500 page document. I want to print
pages 1 to 145 the odd pages first and then the even pages. So that I
can turn the paper over and use both sides of the paper. Then I want
to print pages 278, 345, 590, 601 to 721 and then pages 997 to 1500
odd and then even to use both sides of the paper.
Now I imagine you are thinking, why doesn't he just go and say print
in the application. I have tried that many times. Both in Adobe
Acrobat and Preview. Preview doesn't allow you to print just odd or
even pages. If you want to do that you have to print one page at a
time. When I have used Acrobat and try to print the odd pages and
then the even pages. It always messes things up. I tell it to print
page 14 and it prints page 567. I tell Acrobat to print pages 13 to
24 and it prints the entire file. I would image that you are saying
that I need to go to Adobe and ask them for help. I have already done
that and gotten no-where.
I am wondering if there are a bunch of scripts that someone has
already made that I could use and just change a little? Please keep
in mind that things have to be kept simple as my brain cannot handle
anything complex.
Please let me know if you have any ideas on what I can do or if you
have any scripts that you could share with me that would be easy for
me to edit.
Thank you so much!!
Have a happy day!
Larry
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.