You can still remove annoying agreement prompts from Mac disk images (.dmg files)

I got tired of accepting agreement notices when opening distributed disk image (.dmg) files, so I created this script. It should work until certain people decide it shouldn’t. Create a MacOS Service using Automator with one Run AppleScript action, and make the service accept documents in Finder. Paste the following AppleScript into the Run AppleScript action and save. Here’s the shortest complete documentation I could find (written by Ben Waldie, an extremely proficient Mac automation enthusiast) that explains how to use Automator to quickly deploy AppleScripts as MacOS Services.

After you’ve added the MacOS Service, when you encounter a disk image that you’ve downloaded that wants you to agree to something before it opens, just click “disagree”, then launch the service from the contextual menu (right-click the disk image). After a few seconds (depending on the size of the image), you can double-click it and it will open with no further nagging.

property temppath : "/private/tmp/"

on run {input}

 (* Your script goes here *)
 repeat with the_item in input
 end repeat
end run

on build_archive(the_item)
 --repeat with the_item in the_items
 set the_item to the_item as alias
 tell application "Finder"
 set sost to ((container of file (the_item as string)) as alias) as string
 end tell
 set sost to POSIX path of sost
 on error therrr
 log therrr
 display dialog therrr
 set sost to "/Volumes/"
 end try
 set this_filepath to (the_item as string)

 if last character of this_filepath is ":" then
 tell me to set it_is_a_folder to true
 set it_is_a_folder to false
 end if
 if not it_is_a_folder then
 set thesourcename to (name of (info for the_item))
 set the_source_file to POSIX path of this_filepath
 set pos_filepath to sost
 --set thesourcename to replace_chars(thesourcename, " ", "_")
 set dest_file to (quoted form of (temppath & thesourcename))
 set tempname to ((characters 1 thru -5 of thesourcename) & "temp")
 set my_command to "hdiutil convert -format UDRW" & space & (quoted form of the_source_file) & space & "-o" & space & (quoted form of (temppath & tempname))
 do shell script my_command
 set my_2nd_command to "hdiutil convert" & space & (quoted form of (temppath & tempname & ".dmg")) & space & "-format UDZO -imagekey zlib-level=9 -o" & space & (quoted form of (temppath & thesourcename))
 do shell script my_2nd_command
 do shell script "rm" & space & (quoted form of (temppath & tempname & ".dmg"))
 on error onerr
 display dialog onerr
 end try

 if pos_filepath is "/Volumes/" then
 set pos_filepath to (POSIX path of (path to desktop folder))
 end if
 set targdetect to (pos_filepath & thesourcename)
 set name_target to alias (POSIX file targdetect)
 --use this instead of above to prevent overwriting your original disk image: set finishname to "_recomp"
 set finishname to ""
 set thesourcename to (((characters 1 thru -5 of thesourcename) & finishname) as Unicode text)
 tell me to do shell script "ditto -rsrcFork" & space & dest_file & space & "\"" & (pos_filepath & thesourcename) & ".dmg" & "\""
 end if
 do shell script "rm" & space & dest_file
 end try
 --end repeat
end build_archive

Fix Home Folder Permissions

Here’s an AppleScript to help you regain control of your user home folder if permissions have been corrupted by performing certain actions such as installing software that doesn’t respect proper home folder permissions or by drag copying items when the current context for maintaining proper permissions is incorrect. Symptoms of this problem can range from not being able to see on the desktop items that are known to exist in the Desktop folder or not being able to move icons for desktop items to being unable to copy or move items inside the home folder.

The current user account must be an admin account when the script is used. If the account needing repair is not currently an admin account, you can use the Users & Groups prefpane to make it an admin account temporarily to run the script (providing, of course, that you have access to an admin account).

set username to do shell script "id -un"

do shell script "chown -R" & space & username & space & "~;chmod -RN ~;chmod -R o-w ~;chmod +a \"everyone deny delete\" ~/ ~/Desktop ~/Documents ~/Downloads ~/Library ~/Movies ~/Music ~/Pictures ~/Public ~/Sites;chmod +a \"" & username & space & "allow list,add_file,search,delete,add_subdirectory," &  "delete_child,readattr,writeattr,readextattr," &  "writeextattr,readsecurity,writesecurity,chown,file_inherit," & "directory_inherit\" ~/Public/Drop\\ Box" with administrator privileges


Login Items List

This is an AppleScript to give you control over your Mac user login items. They are the items displayed when you open System Preferences>Users & Groups>Login items (your user must be selected at the left in the Users & Groups prefpane).

Copy and paste the text on the right side in the text block below into an empty document window of Script Editor or AppleScript Editor on your Mac system. This script has worked since Mac OS X 10.3 Panther and I still use it in MacOS 10.12.5 Sierra.

Run the script.

Select one or more login items from the list and click OK.

Choose whether to reveal the login item in the Finder or to remove it from the current login items. (Tip: try revealing one or more login items first and if you don’t really want them removed after you test removing, just open login items in the Users & Groups System prefpane and drag them back in there!)

tell application "System Events"
set loginItems to name of every login item
choose from list loginItems with multiple selections allowed
end tell
set theResult to result
if theResult is false then
tell me to quit
if (count of items of theResult) is not 0 then
if (count of items of theResult) is 1 then
display dialog "What do you want to do with" & ¬
space & every item of theResult & "?" buttons ¬
{"Cancel", "Reveal it", "Remove it"}
display dialog "What do you want to do with
the selected login items?" buttons ¬
{"Cancel", "Reveal them", "Remove them"}
end if
if button returned of result contains "Remove" then
repeat with i in theResult
tell application "System Events"
delete (every login item whose name is (i as text))
end tell
end repeat
set this_user to (do shell script "id -un")
do shell script "killall -u" & space & this_user & space & "cfprefsd"
do shell script "killall -u root cfprefsd" with administrator privileges
else if button returned of result contains "Reveal" then
repeat with i in theResult
tell application "System Events"
set loginitempaths to (get the path of every login item)
repeat with loginitempath in loginitempaths
if loginitempath contains (i as text) then
set g to (loginitempath as text)
end if
end repeat
end tell
set actual_Path to POSIX file g
tell application "Finder"
reveal (actual_Path as text)
end tell
end repeat
end if
end if
end if

Mallet Finger Injury – Two Years Later

When I sought medical attention for a mallet finger injury two years ago, what I learned was that I shouldn’t expect the affected finger ever to be exactly the same again. While that may be technically true, I was able to recover well enough that only very slight evidence of the injury remains, evidence that would only be detectable under very close examination. I’m convinced that the reason I recovered so well is that I took the initiative to build my treatment around my own design and method for making a custom splint.

The generic splint prescribed for me was too big and very difficult to keep fitted. It made the finger protrude enough past normal length that the finger was entirely unusable and the use of the entire hand was adversely affected.

To make a more effective, comfortable splint, I used a modeling material called InstaMorph, which can be heated to a temperature of 150° farenheit in water to allow it to become moldable. I then wrapped the warm pliable material around my finger and molded it to immobilize the affected joint only, and to support the fingertip while leaving it exposed, allowing me to use it for typing, etc. Of course it took a few tries, but once it felt right, I was able to wear it for the duration of the recommended splinted recovery time, both day and night, about 8 weeks. If my finger felt loose in the splint or I felt that it had accumulated too much dirt during the period, I simply discarded it and made another using more InstaMorph. I think I may have gone through 3 or 4 generations.

The goal of the design for the fingertip support point of the splint is that the joint be stretched slightly more backward than for a normal straight resting position for the joint. But it’s not necessary to bend the joint backwards far enough to make it uncomfortable. It’s possible to achieve this goal by realigning the fingertip support point while the InstaMorph is still somewhat pliable. That means removing the splint during the formation process and changing the shape slightly before it cools enough to become entirely rigid. Removing the splint before it becomes rigid during the formation process also ensures that the splint isn’t molded tightly enough to make it difficult to remove or to constrict the finger enough to adversely affect blood flow.

It’s important not to allow the affected joint to bend even once during the eight weeks, and wearing the splint, although removing it was easy, helped me achieve that goal. Along with exercises which consisted only of spreading and backward arching of all the fingers on the affected hand to the maximum possible position, the treatment has proved quite effective. After the eight weeks had passed, there was some residual feeling of weakness in the joint that lasted for a couple more months. However, during that time, I simply reapplied the splint temporarily whenever I became aware of the weak sensation in the joint, or when I considered that my activities might be increasing the likelihood of re-injury. The orthopedic surgeon who treated me was impressed enough to ask my permission to photograph the splint. The included photos that I took myself illustrate the overall design concept for the homemade splint.



Consolation2 – Log helper for Sierra

If you’ve missed the Console’s ability to access previous log entries in MacOS 10.12 – Sierra, Consolation2 can help. The interface, though actually quite simple, may appear somewhat intimidating to users who aren’t familiar with the many possibilities for examining log entries in MacOS. However, an extensive Help Book is available through the Help menu of the app, and contains lots of instructions and example scenarios for getting the most out of Consolation2.

Absird for Mac

Some 20 years ago, I became interested in Autostereograms. It was already at least several years after their popularity had peaked. Several years after working with them, I was able to port an old freeware Unix executable distributed by a gentlemen named Keith Goldfarb into Apple’s then free Xcode environment to create a graphical user interface for creating Autostereograms using a Mac. I haven’t upgraded it into the more complex Mac developer environment for use with the current Mac App Store, but if you’re comfortable tweaking GateKeeper to allow older or outsider apps to work on your Mac, you’re invited to play with Absird. A shortcut for getting around GateKeeper is available on my Really Quick page. Download from my Google Sites repository below.


First blog post – symbols and characters

Let’s see what we have here. OK, here are some symbols and characters for testing and reference.

Symbol   Name           Hex      Dec

⇧         Shift           21E7    8679

⌃         Control         2303    8963

⌥         Option          2325    8997

⌘         Command         2318    8984

⌦         Delete Right    2326    8998

⌫         Delete Left     232B    9003

⎋         Escape          238B    9099

⏏         Eject           23CF    9167

↩         Return          21A9    8167

←         Left Arrow      2190    8592

↑           Up Arrow        2191    8593

→         Right Arrow     2192    8594

↓         Down Arrow      2193    8595

⇞         Page Up         21DE    8670

⇟         Page Down       21DF    8671

↖         Home               2196    8598

↘         End                2198    8600

⇥         Tab                21E5    8677

⇭          NumLock          21ED    8685

⌧         Clear             2327    8999

⌅         Enter             2305    8965

         Apple Symbol    F8FF   63743