• 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
Fwd: Auto mount .dmg in High Sierra? Possible??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Auto mount .dmg in High Sierra? Possible??


  • Subject: Fwd: Auto mount .dmg in High Sierra? Possible??
  • From: Brian Christmas <email@hidden>
  • Date: Mon, 26 Mar 2018 21:21:30 +1100

G’day Scripters

Here’s a part working script to try and set auto expansion/display of
downloaded disk images.

However, under High Sierra I just cannot get the downloaded file to mount, even
when it’s zipped.

If anyone can test it for me I’d appreciate it, particularly under just Sierra
10.12,.x

Anyone got any suggestions? BTW, my preferences are to expand safe files.

Here’s a link to one of my websites for live assessment.

http://meselfsoftware.com/Art Archiver/
<http://meselfsoftware.com/Art Archiver/>

Regards

Santa




tell application "System Events" to display dialog "•• IMPORTANT ••." & return
& return & "You should open the Disk Image that will be processed, and size the
window, add any picture background ('Show View Options' in the 'View' Menu),
turn of superfluous items such as 'Tab Bar', etc, and then process the Disk
Image with its window open, please!." giving up after 3600
tell application "System Events" to display dialog "•• IMPORTANT ••." & return
& return & "Displaying for 3 seconds" & return & "You will now be offered to
select a Disk Image to process." giving up after 3


tell application "System Events" to set myFile to choose file of type {"dmg"}
with prompt "Please select a disk image to set the 'auto open' on :"
set myPath to quoted form of POSIX path of myFile
tell application "Finder" to set myName to (name of myFile) as text
set myNameTwo to quoted form of ((characters 1 thru ((offset of "." in myName)
- 1) of myName) as text)
set shellScript to "hdiutil attach -verify -autofsck -mount required " & myPath
set tempAction to do shell script shellScript

tell application "System Events" to display dialog "Details below." & return &
"Please wait 3 seconds." & return & return & myName & return & return &
myNameTwo & return & return & tempAction giving up after 3
set endTextPath to replace_chars(tempAction, "/")
repeat 4 times
        try
                set the_ID to (do shell script "df -hlg | grep -m 1" & space &
quoted form of endTextPath & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
                do shell script "hdiutil detach " & the_ID
        end try
end repeat
tell application "System Events" to display dialog "•• IMPORTANT ••." & return
& return & "Displaying for 3 seconds" & return & "You will now select a new
Folder for the processed Disk Image." giving up after 3
tell application "System Events" to set myFolder to choose folder with prompt
"If desired, please select a new folder in which to save a minimized version of
the disk image, or Cancel if you do not want to minimize the new .dmg size:"

set folderPath to quoted form of POSIX path of ((myFolder as text) & myName)
set shellScriptThree to "hdiutil convert " & myPath & " -ov -format UDZO -o " &
folderPath
#tell application "System Events" to display dialog "Script to be executed
below." & return & "Please wait 3 seconds." & return & return &
shellScriptThree giving up after 3
do shell script shellScriptThree

#set shellScriptFour to "hdiutil mount " & folderPath
#set tempAction to do shell script shellScriptFour

set shellScriptFive to "hdiutil attach -verify -autofsck -mount required " &
folderPath
set tempAction to do shell script shellScriptFive

repeat 4 times
        try
                set the_ID to (do shell script "df -hlg | grep -m 1" & space &
quoted form of endTextPath & space & "| grep -o 'disk[0-9][a-z][0-9]*'")
                do shell script "hdiutil detach " & the_ID
        end try
end repeat
try
        tell application "Finder"
                activate
                open folder myFolder
        end tell
end try

shellScript & return & return & shellScriptThree & return & return &
shellScriptFive

on replace_chars(this_text, search_String)
        set KeepDelimiters to AppleScript's text item delimiters
        set AppleScript's text item delimiters to the search_String
        set the item_path to last text item of this_text
        set AppleScript's text item delimiters to KeepDelimiters
        return item_path
end replace_chars


 _______________________________________________
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

References: 
 >Re: Auto mount .dmg in High Sierra? Possible?? (From: Brian Christmas <email@hidden>)

  • Prev by Date: Re: Can someone please confirm this....
  • Next by Date: Re: Can someone please confirm this....
  • Previous by thread: Re: Auto mount .dmg in High Sierra? Possible??
  • Next by thread: Re: Auto mount .dmg in High Sierra? Possible??
  • Index(es):
    • Date
    • Thread