• 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: about PDFpenPro
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about PDFpenPro


  • Subject: Re: about PDFpenPro
  • From: Yvan KOENIG <email@hidden>
  • Date: Sat, 18 Mar 2017 10:26:33 +0100


Le 17 mars 2017 à 23:33, Christopher Stone <email@hidden> a écrit :

Hey Yvan,

I have the paid version of PDFPenPro.

When I create a new blank document by hand I get exactly the same error than the one I get with the script.

Interesting.  Very good catch!

I don't see a way to make a new 1 page document via script, but I'll inquire.

If I create a new one page document, I get a document with a watermark which saves flawlessly.

Mine saves just fine manually – but balks with permission problems if I try to save via AppleScript.

I didn't have file before the path...

Hmm.  Your script worked well 3-4 times and then stopped working with permission errors...

Bah!

Okay – this works without issue.

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

set savePath to (path to desktop as text) & "test.pdf"

do shell script "touch " & quoted form of POSIX path of savePath

my createOnePageBlank()

tell application "PDFpenPro"
    save document 1 in file savePath
end tell

---------------------------------------------------------
on createOnePageBlank()
    tell application "System Events" to tell process "PDFpenPro"
        set frontmost to true
        keystroke "n" using {command down}
    end tell
end createOnePageBlank
---------------------------------------------------------

--
Take Care,
Chris

Hello Chris

(1) It seems that close access (open for access file savePath) is faster than do shell script "touch " & quoted form of POSIX path of savePath

(2) At first run I'm forced to add the instruction tell application "PDFpenPro" to activate before calling the handler.

(3) As I never used PDFpenPro before testing your script, I used  save document 1 in file savePath  as I do most of the time.
After receiving your message, I tried to remove it and the script works well without "file".

(4) Is the original script failing on your mac if you add the instruction close access (open for access file savePath) ( or do shell script "touch " & quoted form of POSIX path of savePath) ?
It fails for me but I wonder if it does the same with the paid version.

(5) When there is already a true PDF named "test.pdf", the script fails - after 1 or some run - with the error : error "Erreur dans PDFpenPro : Il est impossible d’obtenir document 1. Index non valable." number -1719 from document 1

Here is a version getting rid of all these comments.

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

set savePath to (path to desktop as text) & "test.pdf"
tell application "System Events"
if exists disk item savePath then
delete disk item savePath
delay 0.5 # maybe a smaller value would be OK
end if
end tell

-- do shell script "touch " & quoted form of POSIX path of savePath
close access (open for access file savePath)


my createOnePageBlank()

tell application "PDFpenPro"
save document 1 in savePath
end tell

---------------------------------------------------------
on createOnePageBlank()
tell application "PDFpenPro" to activate
tell application "System Events" to tell process "PDFpenPro"
set frontmost to true
keystroke "n" using {command down}
end tell
end createOnePageBlank
---------------------------------------------------------


Yvan KOENIG running Sierra 10.12.3 in French (VALLAURIS, France) samedi 18 mars 2017 10:25:44




 _______________________________________________
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: about PDFpenPro
      • From: Christopher Stone <email@hidden>
References: 
 >Re: about PDFpenPro (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: about PDFpenPro
  • Next by Date: Re: about PDFpenPro
  • Previous by thread: Re: about PDFpenPro
  • Next by thread: Re: about PDFpenPro
  • Index(es):
    • Date
    • Thread