• 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
Re: AppleScript-Users Digest, Vol 13, Issue 525
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript-Users Digest, Vol 13, Issue 525


  • Subject: Re: AppleScript-Users Digest, Vol 13, Issue 525
  • From: Steven McCarthy <email@hidden>
  • Date: Thu, 05 Jan 2017 08:48:15 -0500

. Re: Cropping pdf in ACROBAT (Brian Christmas)

Hi Brian,  FYI - I have had much luck cropping the excess image in Acrobat using the following.

tell application "Adobe Acrobat Pro"

tell active doc

repeat with i from 1 to count of pages

tell page i

set cbox to crop box

set tbox to trim box

set bbox to bleed box

set abox to art box

--set media box to cbox

set media box to tbox

--set media box to bbox

--set media box to abox

end tell

end repeat

end tell

end tell



Regards,

Steve McCarthy
email@hidden



On Sun, Dec 25, 2016 at 5:42 AM, <email@hidden> wrote:
Send AppleScript-Users mailing list submissions to
        email@hidden.com

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.apple.com/mailman/listinfo/applescript-users
or, via email, send a message with subject or body 'help' to
        applescript-users-request@lists.apple.com

You can reach the person managing the list at
        applescript-users-owner@lists.apple.com

When replying, please edit your Subject line so it is more specific
than "Re: Contents of AppleScript-Users digest..."


Today's Topics:

   1. Re: Cropping pdf in ACROBAT (Brian Christmas)
   2. Fwd: Cropping pdf in ACROBAT (Brian Christmas)
   3. Re: Saving to desktop with TextEdit - El Capitan vs Sierra
      [2] (Yvan KOENIG)


----------------------------------------------------------------------

Message: 1
Date: Sun, 25 Dec 2016 07:41:37 +1100
From: Brian Christmas <email@hidden>
To: Applescript Users <applescript-users@lists.apple.com>,      Shane
        Stanley <email@hidden>
Subject: Re: Cropping pdf in ACROBAT
Message-ID: <527F61F0-7A0F-4771-B218-email@hidden>
Content-Type: text/plain; charset="utf-8"

Thanks Shane

Got up early on Christmas morning to prepare my wife's present (new iPad 2), So checking my eMail.

I kept researching after I posted, and found the same thing. Crop does not erase extra images in Acrobat. There IS a way to remove the extra, but Acrobat won’t respond to scripts addressing its menus, and the method also uses graphical interfaces.

So, I maunally tried saving as a tiff, then re-opened the saved file with Acrobat. It opened as a .pdf.

Ir worked!!  TRIMMED OFF THE EXCESS!

However, when I tried to do the same thing with code, it would not save. ‘Save’ cannnot understand, etc.

I used your excellent saving procedure for Sierra, but the compiler for Acrobat changed a critical word,  from ’to', to ‘of’.

Can’t find a way around it, so wondered if using the same line as a shell script would work. I researched, but can’t find out how to actuallty wrirte such as script. Lots of warnings about different types of scripting, and lots on how to save text, etc, but nothing describing my situation. The MAN pages just left me baffled.

Any advice please on a suitable shell script? No hurry. Enjoy Christmas, and have a Merry one.

Regards

Santa


set theItem to ((path to desktop as text) & "AuburnAlumni LifetimeAchievement LARGE DIE LINE 121616_104500.pdf") as text
tell application "Adobe Acrobat"
        activate
        open file theItem
end tell

set theitem2 to "AuburnAlumni LifetimeAchievement LARGE DIE LINE 121616_104500.tiff" as text

set pathToFile to ((path to desktop as text) & theitem2) as text
set theFile to pathToFile as «class furl»
set fileRef to open for access theFile with write permission
close access fileRef
do shell script ("sleep 0.4")
tell application "Adobe Acrobat"
        activate
        say (count of pages of document 1)

        tell page 1 of document 1
                save of theFile
        end tell
        close every document saving no
        open theFile
end tell



> On 24 Dec 2016, at 10:36 pm, Shane Stanley <email@hidden> wrote:
>
> On 24 Dec 2016, at 10:04 am, Brian Christmas <email@hidden> wrote:
>>
>> I need a way, using Xcode ASObjC, to crop the image before expanding it
>
> You're not going to find it. The sort of "cropping" you can do with PDFs isn't real cropping -- it's just setting the area that appears.
>
> I suppose you could try masking out the area outside the crop box with empty text boxes or something, but that's pretty ugly. Or turn the PDF into a bitmap.
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (applescript-users@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20161225/10f741e3/attachment.html>

------------------------------

Message: 2
Date: Sun, 25 Dec 2016 08:28:27 +1100
From: Brian Christmas <email@hidden>
To: Applescript Users <applescript-users@lists.apple.com>
Subject: Fwd: Cropping pdf in ACROBAT
Message-ID: <19D37650-AE96-4E31-A55F-email@hidden>
Content-Type: text/plain; charset="utf-8"

OOOOPS, SHOULD HAVE READ   I used your excellent saving procedure for Sierra, but the compiler for Acrobat changed a critical word,  from ’in', to ‘of’.



> Begin forwarded message:
>
> From: Brian Christmas <email@hidden>
> Subject: Re: Cropping pdf in ACROBAT
> Date: 25 December 2016 at 7:41:37 am AEDT
> To: Applescript Users <applescript-users@lists.apple.com>, Shane Stanley <email@hidden>
>
> I used your excellent saving procedure for Sierra, but the compiler for Acrobat changed a critical word,  from ’to', to ‘of’.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20161225/a165965d/attachment.html>

------------------------------

Message: 3
Date: Sun, 25 Dec 2016 11:42:42 +0100
From: Yvan KOENIG <email@hidden>
To: liste AppleScript US <applescript-users@lists.apple.com>
Subject: Re: Saving to desktop with TextEdit - El Capitan vs Sierra
        [2]
Message-ID: <B5FE1904-FDB8-4D22-811D-email@hidden>
Content-Type: text/plain; charset="utf-8"

Merry Christmas to all of you.

For testing I used :

set attachmentsFolder to "Volumes:folder1:folder2:"
set attachmentsFolder to (path to documents folder as text) & "4attachments:"
--set attachmentsFolder to (path to desktop as text) & "4attachments:"
--return attachmentsFolder
tell application "System Events"
        exists folder attachmentsFolder
end tell
tell application "Mail"
        set theMessages to the selection
        set selectedMessages to theMessages
        --try
        repeat with theMessage in selectedMessages

                repeat with theAttachment in theMessage's mail attachments
                        try
                                set originalName to name of theAttachment
                                set savePath to attachmentsFolder & originalName
                                tell me to set savePath to POSIX file (POSIX path of savePath)
                                save theAttachment in (savePath)
                                log "saved"
                        end try
                end repeat

        end repeat
        --end try
end tell

It behaved flawlessly under 10.12.1
But under 10.12.2, every attempt to save an attachment issued :

        --> error "Pour afficher ou modifier vos autorisations, sélectionnez l’élément dans le Finder, puis choisissez Fichier > Lire les informations." number -10000

On both systems, the permissions for 4attachments on the desktop are:
me read/write
admin read only
everyone read only
for 4attachments in Documents folder they were:
me read/write
admin read/write
everyone read only
After the tests I restored admin to read only.

It's the third oddity which I face when using AppleScript under 10.12.2 (as bad as 10.12.3)

Report # 29683268, Under 10.12.2 (and 10.12.3) AppleScript keystroke command fails
cf: http://macscripter.net/viewtopic.php?id=45395

Report #29753839 "under 10.12.2 (and 10.12.3) exporting iWork doc thru AppleScript is killed"
cf : http://macscripter.net/viewtopic.php?id=45401 <http://macscripter.net/viewtopic.php?id=45401>

Of course it would be useful to file reports of your own.

I will file one for the Mail problem.

Yvan KOENIG running Sierra 10.12.2 in French (VALLAURIS, France) dimanche 25 décembre 2016 11:42:32






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.apple.com/mailman/private/applescript-users/attachments/20161225/913dfbed/attachment.html>

------------------------------

_______________________________________________
AppleScript-Users mailing list
email@hidden.com
https://lists.apple.com/mailman/listinfo/applescript-users

End of AppleScript-Users Digest, Vol 13, Issue 525
**************************************************

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Creating a list of numbers from a Contacts group
  • Next by Date: Re: 10.12.2 permission errors when saving
  • Previous by thread: Re: Creating a list of numbers from a Contacts group
  • Next by thread: Re: Sierra mail problem
  • Index(es):
    • Date
    • Thread