hadifarnoud

Restart to windows

26 posts in this topic

I created a workflow that restarts you into windows without changing your startup disk. that means if you simply restart in windows, it goes back to OS X again.

 

Download

 

I can improve it with your help. right now you have to change your disk (i.e. /dev/disks0p4) by hand. it could get better if we can detect it automatically.

 

thoughts?

hadifarnoud and heinst like this

Share this post


Link to post

that would work for most cases. right? I mean Bootcamp always use the same name?

Yes, it would work in most cases. 'BOOTCAMP' is the proper name...you could also filter by type of partition

Share this post


Link to post

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).

Share this post


Link to post

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

smirky likes this

Share this post


Link to post

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.

Share this post


Link to post

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.

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

Share this post


Link to post

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.  ;)

hadifarnoud likes this

Share this post


Link to post

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. :)

Share this post


Link to post

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 :(

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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. :)
hadifarnoud likes this

Share this post


Link to post

 

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?

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

Hello!

 

I'm having trouble with the extension after upgrading to Windows 10 and El Capitan. Is anyone else encountering this? The computer restarts to OS X, not Windows.

 

Thanks!

Share this post


Link to post

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