Re: Auto mount .dmg in High Sierra? Possible??
Re: Auto mount .dmg in High Sierra? Possible??
- Subject: Re: Auto mount .dmg in High Sierra? Possible??
- From: Brian Christmas <email@hidden>
- Date: Sat, 24 Mar 2018 16:13:38 +1100
Thanks Laine, and Ed, and Paul.
Here’s the modified code, but its still generating an error, even tho Laine’s
routine, with my all purpose modification, unmounts the disk. Paul, using the
original variable pointing to the disk generates an error. Perhaps once the
attachment is made, it’s a though the old disk is now not seen.
do shell script shellScriptThree
-->hdiutil: convert failed - Resource temporarily unavailable. WHAT DOES THIS
MEAN???
This has become a matter of "I’m determined to get it running", more than the
sheer convenience.
Regards
Santa
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
--> "hdiutil attach -noverify -noautofsck -mount required
'/Users/OzSanta/Documents/My XCode Projects/AA Sierra Public/Web Site stuff/Art
Archiver.dmg'"
tell application "System Events" to display dialog myName & return & return &
myNameTwo & return & return & tempAction giving up after 3
set endTextPath to replace_chars(tempAction, "/")
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 "diskutil unmount" & space & the_ID
#do shell script ("sleep 1")
tell application "System Events" to set myFolder to choose folder with prompt
"If desired, please select a new folder in which to save a compressed version
of the disk image, or Cancel :"
set folderPath to quoted form of POSIX path of ((myFolder as text) & myName)
set shellScriptThree to "hdiutil convert " & myPath & " -format UDZO -o " &
folderPath
tell application "System Events" to display dialog shellScriptThree giving up
after 20
-->hdiutil convert '/Users/OzSanta/Documents/My XCode Projects/AA Sierra
Public/Web Site stuff/Art Archiver.dmg' -format UDZO -o
'/Users/OzSanta/Documents/My XCode Projects/AA Sierra Public/Web Site
stuff/Release dmg'\''s/Art Archiver.dmg'
do shell script shellScriptThree
-->hdiutil: convert failed - Resource temporarily unavailable WHAT DOES THIS
MEAN???
shellScript & return & return & shellScriptThree
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
(*
convert image -format format -o outfile
convert image to type format and write the result to outfile.
As with create, the correct filename extension will be added
only if it isn't part of the provided name. Format is one of:
UDRW - UDIF read/write image
UDRO - UDIF read-only image
UDCO - UDIF ADC-compressed image
UDZO - UDIF zlib-compressed image
ULFO - UDIF lzfse-compressed image (OS X 10.11+ only)
UDBZ - UDIF bzip2-compressed image (Mac OS X 10.4+ only)
UDTO - DVD/CD-R master for export
UDSP - SPARSE (grows with content)
UDSB - SPARSEBUNDLE (grows with content; bundle-backed)
UFBI - UDIF entire image with MD5 checksum
UDRo - UDIF read-only (obsolete format)
UDCo - UDIF compressed (obsolete format)
RdWr - NDIF read/write image (deprecated)
Rdxx - NDIF read-only image (Disk Copy 6.3.3 format;
deprecated)
ROCo - NDIF compressed image (deprecated)
Rken - NDIF compressed (obsolete format)
DC42 - Disk Copy 4.2 image (obsolete format)
*)
> On 24 Mar 2018, at 12:36 pm, Paul Scott <email@hidden> wrote:
>
> I don't see any problem with doing a detach.
>
> On 3/23/2018 4:50 PM, Brian Christmas wrote:
>> Thanks Paul
>>
>> However, I’m now confused.
>>
>> The hdiutil man pages explicitly seem to say to NOT DETACH AN ACTION, but
>> to unmount a drive, the user should explicitly use the unmount command.
>>
>> Should I use….
>>
>>
>> set shellScript to "hdiutil attach -verify -autofsck -mount required " &
>> myPath
>>
>> set tempAction to do shell script shellScript
>>
>> do shell script "hdiutil unmount “ & tempAction
>>
>>
>> Very hard to test if action is attached or not?
>>
>> Regards
>>
>> Santa
> _______________________________________________
> 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
_______________________________________________
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