Thursday, December 13, 2018

#1 2018-12-06 01:26:36 pm

FONTfitter
Member
Registered: 2011-09-10
Posts: 20

PDF fails to open when called from Disk Image .app

I built an Installer script for my fonts which requires a PDF of a Liceence Agreement to be opened first. Double-clicking the .app with the files in the same Folder works fine on my Hard Disk. Complete file set here...
http://www.sassoonfont.co.uk/fonts/sas/ … -S001C.zip

However - double-clicking installer.app on the downloaded .dmg file that lands on the Mac OS Desktop - fails with with following error:

File alias 702D2512-0B93-42A5-AC27-564B05B684ED:d:Resources:eula.pdf of «script» wasn’t found. (-43)



The is the troublesome snippet:

Applescript:

-- LICENCE AGREEMENT DIALOG ****** (place pdf in Disk Image) ****************
set DMChosenItems to (choose from list {"End User Licence Agreement"} with title "Licence Agreement" with prompt "Please read the Licence Agreement before continuing" OK button name "OK" cancel button name "Cancel" with multiple selections allowed)
if DMChosenItems is false then
   --script if user cancelled
else
   set DMBool to false
   repeat with DMItem in {"End User Licence Agreement"}
       if DMItem is in DMChosenItems then
           set DMBool to true
       end if
   end repeat
   if DMBool then
       --script if result contains desired items
       -- PDF ************************************************
       set theFile to alias ((current_path as text) & "Resources:eula.pdf")
       tell application "Finder" to open file theFile
       -- *************************************************************
   else
       --script if disagree
       quit
   end if
   -- end if is lower
   -- END USER GUIDES DIALOG ************************************

If this script works in a Folder on the Hard Disk, why should it fail when run from Disk Image downloaded to the Desktop?

Tried for ages to solve this so any clues greatly appreciated!


Filed under: PDF, .dmg, .dmg. Disk Image

Offline

 

#2 2018-12-06 02:07:06 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3290

Re: PDF fails to open when called from Disk Image .app

If my memory is right, it would be better to code :

Applescript:

set theFile to alias ((current_path as text) & "Resources:eula.pdf")
tell application "Finder" to open theFile

or

Applescript:

set theFile to ((current_path as text) & "Resources:eula.pdf")
tell application "Finder" to open file theFile

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 6 décembre 2018 21:06:59

Last edited by Yvan Koenig (2018-12-06 02:08:05 pm)

Offline

 

#3 2018-12-06 04:44:03 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5487

Re: PDF fails to open when called from Disk Image .app

FONTfitter wrote:

If this script works in a Folder on the Hard Disk, why should it fail when run from Disk Image downloaded to the Desktop?



It's a security feature of the OS -- the file has to be moved to remove the quarantine settings.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#4 2018-12-11 09:00:14 am

FONTfitter
Member
Registered: 2011-09-10
Posts: 20

Re: PDF fails to open when called from Disk Image .app

Since Apple's introduction of Security & Privacy setting my previously working scripts have this error, even when I accept the "Open anyway" option.

Moving the file is proving impossible manually - I tried:
Downloading dmg and choosing "Save File" to the Downloads Folder.
Dragging the dmg to Hard Disk.
Make Alias of dmg on Hard Disk.

How can I script it so the User gets a seemless download and open routine?

Offline

 

#5 2018-12-11 03:59:38 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5487

Re: PDF fails to open when called from Disk Image .app

FONTfitter wrote:

How can I script it so the User gets a seemless download and open routine?



Put a copy of the PDF inside the app bundle.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)