ฉันกำลังพยายามสร้างเวิร์กโฟลว์อัตโนมัติเพื่อส่งออกเอกสารหน้าเว็บที่เลือกเป็น PDF จนถึงตอนนี้ทุกอย่างเป็นไปด้วยดียกเว้นขั้นตอนการส่งออกขั้นสุดท้าย
on run {input, parameters}
    repeat with _document in input
        tell application "Finder"
            set _directory to get container of file _document
            set _documentName to name of _document
            if _documentName ends with ".pages" then ¬
                set _documentName to text 1 thru -7 of _documentName
            set _PDFName to _documentName & ".pdf"
            set _incrementIndex to 1
            repeat until not (exists file _PDFName of _directory)
                set _PDFName to ¬
                    _documentName & "-" & (_incrementIndex as string) & ".pdf"
                set _incrementIndex to _incrementIndex + 1
            end repeat
            set _location to (_directory as string) & _PDFName
        end tell
        --set _location to (POSIX file of _location)
        tell application "Pages"
            activate
            open _document
            with timeout of 1200 seconds
                export front document to file _location as PDF
            end timeout
            close front document
        end tell
    end repeat
    return input
end run
นี่ทำให้ฉันมีข้อผิดพลาดการอนุญาต Sandbox
error   17:49:38.117966 +0100   sandboxd    SandboxViolation: Pages(3846) deny file-write-create /Users/brunoscheele/Desktop/Test.pdf
Violation:       deny file-write-create 
 หลังจากอ่านเสร็จแล้ว  ที่นี่ ดูเหมือนว่าฉันจะแก้ไขได้โดยเปลี่ยน _location เพื่อ POSIX file. 
ดังนั้นฉันจึงเพิ่ม;
--set _location to (POSIX file _location)
อย่างไรก็ตามนั่นทำให้ฉันเกิดข้อผิดพลาด:
หน้ามีข้อผิดพลาด: "macOS: ผู้ใช้: brunoscheele: เดสก์ท็อป: Test.pdf" ไม่สามารถตีความเป็น URL ไฟล์ได้
 การใช้ export front document to (POSIX file _location) as PDF ทำให้ฉันมีข้อผิดพลาดเดียวกัน 
 ไม่มีใครรู้วิธีการตั้งค่า _location ถูกต้องดังนั้นคุณไม่พบปัญหาเรื่องการอนุญาตหรือไม่