hadifarnoud Posted March 15, 2013 Share Posted March 15, 2013 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 2 Link to comment
cmsj Posted March 15, 2013 Share Posted March 15, 2013 What about looking at the output of "diskutil list" for a volume called BOOTCAMP? Link to comment
hadifarnoud Posted March 15, 2013 Author Share Posted March 15, 2013 that would work for most cases. right? I mean Bootcamp always use the same name? Link to comment
heinst Posted March 21, 2013 Share Posted March 21, 2013 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 Link to comment
hadifarnoud Posted March 22, 2013 Author Share Posted March 22, 2013 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). Link to comment
heinst Posted March 24, 2013 Share Posted March 24, 2013 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 1 Link to comment
heinst Posted March 24, 2013 Share Posted March 24, 2013 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
hadifarnoud Posted March 24, 2013 Author Share Posted March 24, 2013 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 Link to comment
heinst Posted March 24, 2013 Share Posted March 24, 2013 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 1 Link to comment
hadifarnoud Posted March 24, 2013 Author Share Posted March 24, 2013 Thanks. I add your name in my tumbler post too hadifarnoud 1 Link to comment
binarysmurf Posted May 26, 2013 Share Posted May 26, 2013 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
Ramshank Posted May 26, 2013 Share Posted May 26, 2013 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
hadifarnoud Posted May 26, 2013 Author Share Posted May 26, 2013 (edited) 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 May 26, 2013 by hadifarnoud Link to comment
hadifarnoud Posted May 26, 2013 Author Share Posted May 26, 2013 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
hadifarnoud Posted May 26, 2013 Author Share Posted May 26, 2013 I wrote a new post for this workflow here Link to comment
binarysmurf Posted May 30, 2013 Share Posted May 30, 2013 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 1 Link to comment
hadifarnoud Posted May 30, 2013 Author Share Posted May 30, 2013 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
TKilaker Posted July 8, 2013 Share Posted July 8, 2013 I'll start use it from now, thanks! I like what you did with v2. hadifarnoud 1 Link to comment
hadifarnoud Posted March 2, 2014 Author Share Posted March 2, 2014 I tried this but it is not working did you try that with new version? http://hadifarnoud.tumblr.com/post/51391217556/painless-restart-to-windows-with-alfred-shell-script-v2 follow these instruction Link to comment
hadifarnoud Posted March 2, 2014 Author Share Posted March 2, 2014 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
hadifarnoud Posted March 2, 2014 Author Share Posted March 2, 2014 if you type who in terminal, you'll see your username Link to comment
hadifarnoud Posted March 3, 2014 Author Share Posted March 3, 2014 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
mmcduffie Posted September 21, 2014 Share Posted September 21, 2014 To give focus to the admin password dialog add this line before the do shell: tell current application to activate Link to comment
mg32 Posted October 16, 2015 Share Posted October 16, 2015 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! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now