• 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: How can I get the count of these menu items?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I get the count of these menu items?


  • Subject: Re: How can I get the count of these menu items?
  • From: Brian Christmas <email@hidden>
  • Date: Mon, 20 Jul 2015 16:47:47 +1000

G’day Shane

Yeah, it’s real crazy!

I’m responding to a post on the Yahoo GraphicConverter site were a user has scanned a 200 page document as a pdf, and wants to use the GC De-speckle filter on every page, and save it. 

There’s no direct command, so I wrote a GUI script to do the job, but found that GC’s page count option does not work with pdf’s, only returns a ‘1’.

ATM, my script requires the user to manually alter the script to reflect the page count.

So, out of interest, I'm looking for a way of obtaining the page count of a GraphicConverter pdf, using vanilla Applescript.

Regards

Santa


On 20 Jul 2015, at 4:34 pm, Shane Stanley <email@hidden> wrote:

On 20 Jul 2015, at 3:54 pm, Brian Christmas <email@hidden> wrote:

I’d like to get the page count of a multi-page pdf

Is there some reason you're trying to use GraphicConverter for this? Because it seems a very odd choice. And using GUI scripting for it seems crazy...

use framework "Foundation"
use framework "Quartz"

set posixPath to "/Users/shane/Desktop/Everyday AppleScriptObjC.pdf"
set anNSURL to current application's class "NSURL"'s fileURLWithPath:posixPath
set thePDFDoc to current application's PDFDocument's alloc()'s initWithURL:anNSURL
set thePageCount to thePDFDoc's pageCount()

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
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
  • Follow-Ups:
    • Re: How can I get the count of these menu items?
      • From: Shane Stanley <email@hidden>
References: 
 >Re: How can I get the count of these menu items? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: How can I get the count of these menu items?
  • Next by Date: Re: How can I get the count of these menu items?
  • Previous by thread: Re: How can I get the count of these menu items?
  • Next by thread: Re: How can I get the count of these menu items?
  • Index(es):
    • Date
    • Thread