Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScripts Stopped Working

The following AppleScripts, stopped working. This occurs when I attempt to run the script from within the Script Editor, and, when I run the script from applications that I saved them as.


Recently, I erased the internal hard drive, on my iMac. I reinstalled OS X El Capitan, the applications, and my user data. Subsequently, the AppleScripts stopped working. The AppleScript code, follows:



Reboot To Selected Volumes:


display dialog "Select a startup disk" buttons ¬

{"Macintosh HD", "Macintosh HD Maintenance Clone", "iMac Bootable Clone FD - KRT"}

set bootVol to the button returned of the result as text

do shell script "bless -mount \"/Volumes/" & bootVol & ¬

"\" -setBoot" with administrator privileges

do shell script "shutdown -r now" with administrator privileges



Reboot To Macintosh HD:


set deviceID to (do shell script "diskutil list | awk '/Macintosh HD/ {print $NF}'")

do shell script "bless -device /dev/" & deviceID & ¬

" -setBoot -nextonly" with administrator privileges

tell application "Finder" to restart



Reboot To Macintosh HD Maintenance Clone:


set deviceID to (do shell script "diskutil list | awk '/Macintosh HD Maintenance Clone/ {print $NF}'")

do shell script "bless -device /dev/" & deviceID & ¬

" -setBoot -nextonly" with administrator privileges

tell application "Finder" to restart



Any thoughts?


Thank you.

iMac, OS X El Capitan (10.11.3)

Posted on Apr 29, 2016 10:40 AM

Reply
8 replies

Apr 29, 2016 11:06 AM in response to Niel

Hello, Niel.


Thank you for your advice. I will consider it.


Off topic, are you familiar with File Vault encrypted external hard drives not ejecting properly during restart, thus, inhibiting restart? I posted this problem, elsewhere, in the Apple forums. I have conferred with others, who have experienced this problem, however, without resolution.


Thank you.

Apr 29, 2016 11:19 AM in response to Vark Shark

Hello Vark,

I used to have a restart script very similar to what you describe. In my case, any time I used the script it triggered a full rebuild of the Spotlight index on the drive. I was still using mechanical hard drives then so I noticed it. You might not notice this with an SSD, but it would still be draining your CPU and battery, if you have one.


The other problem you describe is well-known. You can try to doing an SMC reset. It might help, might not.

Apr 29, 2016 12:53 PM in response to etresoft

Hello, etresoft.


I am scratching my head, in search of another simple AppleScript solution. This one was elegant.


I tried resetting the SMC and the PRAM. Neither one of these procedures solved the restart problem. Seeing how the problem first surfaced (for me) in Yosemite, perhaps, Apple will address it in 10.12.


Did you write the EtreCheck software? Nice piece of work. I have rarely used it. However, during those few uses, I was impressed.


Thank you.

Apr 29, 2016 4:07 PM in response to Vark Shark

Hello again Vark,

Yes, EtreCheck is mine. Thanks!


I think you might want to start a new question for the problem restarting. There is a common problem with 10.10+ being unable to eject external drives. I had that problem and an SMC reset fixed it. However, I don't recall that ever causing problems for restarts. What you are experiencing may be something different. You may need to look into log messages from the time you initiate the restart.


I can tell you that Apple doesn't really support multiple boot drives anymore. They don't tell you that you can't do it. They just don't test it and aren't concerned with the big list of problems that can result from it on modern machines. It can be done safely, but you have to be really careful. While you can use clones, there is really no guarantee of going back to the original drive successfully. Usually problems are related to iCloud and Handoff. There is a little known problem with uniquely identifying a single machine. If you do anything fancy with multiple machines or multiple hard drives, you can get into a situation where two machines/drives think they are the same and iCloud and other devices get confused.


My official recommendation these days is to just avoid it completely. Use Time Machine as a primary, and maybe secondary backup. Clones are fine as long as you never use them, or, if you do, you never use the original again. Never use Time Machine to copy a user account from one machine to another. If you must use multiple boot partitions or drives, make sure that no user account is ever shared between them. Also make sure that no iCloud account is ever shared between them.

AppleScripts Stopped Working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.