Jump to content

Restart to windows


Recommended Posts

diskutil info BOOTCAMP gives me what I want. I dont know how to parse that output and just get /dev/disks0p4 out of it for example (in bash).

 

You will probably have to use a language, like python because it is built into mac os x, and use a a for loop to go through what the diskutil returns. This gives an example of how to use bash in python. http://stackoverflow.com/questions/4256107/running-bash-commands-in-python

Link to comment

diskutil info BOOTCAMP gives me what I want. I dont know how to parse that output and just get /dev/disks0p4 out of it for example (in bash).

I figured out a way. just need to figure out how to implement it. Itll be done tomorrow. Works through applescript editor, just not when called using alfred.

Link to comment

Great. That's a good start. I can improve upon it

Here you go https://dl.dropbox.com/u/17946577/Restart%20to%20Windows.alfredworkflow I did a few things. I changed the code so that it will always reboot to the drive no matter the location, but it has to be named BOOTCAMP. I also Changed the post notification to report an error, because if it does it correctly the OS won't have time to display a notification so having the notification telling you what it was doing was pointless. I also changed the description of what it would do and I changed it to run faster in the background using the osascript. Finally, I added me to the list of people who it was made by, since I think i deserve a little credit.  ;)

Link to comment
  • 2 months later...

Great workflow. I agree that is would be better to not have to type the password, but this is a good compromise.

 

I love the fact that within 2 minutes of thinking "Hmm.. It would be handy if Alfred could..", I've found a workflow that does pretty much what I need. You guys rock. :)

Link to comment

Hey, I don't know if anyone else has experienced this, but I thought I'd just chip in and let you know.

When using this workflow to restart into windows 7, it stops me from being able to turn my brightness up and down.  However if I manually boot into windows it's fine, same goes for choosing windows as my startup disk.  At first I thought it was to do with windows update updating my drivers, but it's not.
 

I was wondering if there was a fix for this workflow so that my brightness would work?  If not I just wanted to highlight the problem for other people that might of experienced the same thing and not known why it was happening.

 

This is what I discovered regarding the problem. Original Discussion

 


I also see this problem on a MacBookPro 8,2 (late2011):

*When booting Windows 7 with rEFIt, brightness control does NOT work.
*When booting Windows from the option menu at startup, brightness WORKS.
*When booting Windows using Startup Disk pref. pane in OS X, brightness WORKS.
*When booting Windows from the Windows Boot Camp program, brightness WORKS.

When the brightness works, both the keyboard shortcuts and Windows Control Panel controls work. When it doesn't work, neither the shortcut keys nor the Control Pane controls work. Based on this, I infer that it's something to do with rEFIt.

I wonder if anyone who uses rEFIt has the skills to debug and code up a fix for this type of thing. I don't :(

Link to comment

Great workflow. I agree that is would be better to not have to type the password, but this is a good compromise.

 

I love the fact that within 2 minutes of thinking "Hmm.. It would be handy if Alfred could..", I've found a workflow that does pretty much what I need. You guys rock.  :)

 

Thanks

 

You don't have to enter password everytime. please follow these instructions: http://hadifarnoud.tumblr.com/post/44852828042/painless-restart-to-windows-with-alfred-shell-script

 

EDIT: Please note that is the old version of the workflow. you just follow this part:

 

First, you need to edit your sudoer file to allow bless command to run without needing password.

sudo nano /etc/sudoers

just after %admin  ALL=(ALL) ALL add this line (replace Username with your username)

Username ALL = NOPASSWD: /usr/sbin/bless
Username ALL = NOPASSWD: /usr/bin/osascript
Edited by hadifarnoud
Link to comment

Hey, I don't know if anyone else has experienced this, but I thought I'd just chip in and let you know.

When using this workflow to restart into windows 7, it stops me from being able to turn my brightness up and down.  However if I manually boot into windows it's fine, same goes for choosing windows as my startup disk.  At first I thought it was to do with windows update updating my drivers, but it's not.

 

I was wondering if there was a fix for this workflow so that my brightness would work?  If not I just wanted to highlight the problem for other people that might of experienced the same thing and not known why it was happening.

 

This is what I discovered regarding the problem. Original Discussion

 

I also see this problem on a MacBookPro 8,2 (late2011):

*When booting Windows 7 with rEFIt, brightness control does NOT work.

*When booting Windows from the option menu at startup, brightness WORKS.

*When booting Windows using Startup Disk pref. pane in OS X, brightness WORKS.

*When booting Windows from the Windows Boot Camp program, brightness WORKS.

When the brightness works, both the keyboard shortcuts and Windows Control Panel controls work. When it doesn't work, neither the shortcut keys nor the Control Pane controls work. Based on this, I infer that it's something to do with rEFIt.

I wonder if anyone who uses rEFIt has the skills to debug and code up a fix for this type of thing. I don't :(

it might be rEFIt. I have the same macbook. let me know if you found the root of the problem. finding out what's wrong is one thing, fixing it another.

Link to comment

I changed the Apple Scripting in the above example to the following, and I now no longer have to enter a password.

 

do shell script "bless -mount /Volumes/Windows -legacy -setBoot -nextonly" password "[YourPassword]" with administrator privileges
do shell script "shutdown -r now" password "[YourPassword]" with administrator privileges
 
Windows is the name of my Bootcamp volume.
Replace [YourPassword] with the appropriate password.
 
Works a treat. Thanks to the original author for the inspiration. :)
Link to comment

 

I changed the Apple Scripting in the above example to the following, and I now no longer have to enter a password.

 

do shell script "bless -mount /Volumes/Windows -legacy -setBoot -nextonly" password "[YourPassword]" with administrator privileges
do shell script "shutdown -r now" password "[YourPassword]" with administrator privileges
 
Windows is the name of my Bootcamp volume.
Replace [YourPassword] with the appropriate password.
 
Works a treat. Thanks to the original author for the inspiration. :)

 

it would be great if I can change this workflow to ask user for password once.

 

anyone?

Link to comment
  • 1 month later...
  • 7 months later...

yes i tried this with the new version.  It might be my user name.  My user name is firstname lastname with a space in between. example would be Mike Larry ALL = NOPASSWD: etc/sbin/bless but when doing that i get syntax error i tried Mike_Larry didnt work, i tried just Mike didnt work either. Also can i make it so that it changes my startup disk to windows? 

 

I tried changing my username to just my first name but that didnt work either

your username does not have a space in it. it's impossible. just use your username all lowercase without any space in it.

Link to comment

used who in terminal i got Ahmed.  so after %admin ALL=(ALL) ALL

ahmed ALL = NOPASSWD: /usr/sbin/bless

ahmed ALL = NOPASSWD: /usr/bin/osascript

i tried this with capital A and still didnt work. Do i have to restart my computer for changes to take affect?

also is there a way so that it changes the startup disk to windows instead of booting back in os x?

 

this might be an obvious thing, but did you actually download the workflow and installed it? 

 

even if you did the sudoer part wrong, it must still work and ask for your password. it worth nothing that your windows partition must be named as BOOTCAMP (where you see /Volumes/BOOTCAMP/ in script).

 

if all that failed, you can change the script to the one below:

tell application "Finder"
	set iconPath to (get name of startup disk) & ":Applications:Utilities:Boot Camp Assistant.app:Contents:Resources:DA.icns" as alias
end tell

do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly; shutdown -r now" password "YOURPASSOWRD" with administrator privileges

this one have your account password in it. Remember to change YOURPASSOWRD.

Link to comment
  • 6 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...