limitedheadroom Posted May 26, 2016 Share Posted May 26, 2016 I used this workflow all the time on my laptop so I could prevent it from sleeping when running shows at work. Possibly one of the most useful workflows I have but now with a new computer and therefore forced to upgrade to El Capitan it no longer works. I'm also using Alfred 3 now, I don't know if that would make a difference. I simply don't understand how it works, while I'm perfectly able to go into terminal and activate or deactivate caffeinate I can't see how the workflow does it's thing so modifying it to work with OSX 10.11 is beyond me. Is anyone able to help? Link to comment
miketheburrito Posted May 31, 2016 Share Posted May 31, 2016 I also got this problem after updating to Alfred 3 - the Caffeinate Control workflow just stopped working. In the meantime, I've downloaded KeepingYouAwake and made a small workflow to toggle it on/off. It works well, but I'd prefer to go back to Caffeinate Control as it doesn't require any third-party software. Hopefully the workflow gets fixed soon! Link to comment
loneranger76 Posted June 5, 2016 Share Posted June 5, 2016 +1 I upgraded to Alfred 3 on my MacBook Air running El Capitan – the Caffeinate workflow is still working fine. However, yesterday I did a clean install of my Mac mini – also El Capitan and Alfred 3 – and the Caffeinate workflow doesn't work at all. It doesn't even remember the settings I specify under "Configure Caffeinate Control". Maybe the developer could chime in? It has barely been 24h and I already miss the ease of use of the workflow and had to revert back to a menu bar app… :-/ Link to comment
deanishe Posted June 5, 2016 Share Posted June 5, 2016 (edited) In most cases like this, the reason it works for some and not others is because the workflow has Alfred 2's directories hard-coded in it. If you still have your Alfred 2 directories (in ~/Library), it works. If not, it doesn't. You probably just need to open up the workflow's source code in an editor and change any occurrence of "Alfred 2" to "Alfred 3". Edited June 5, 2016 by deanishe miketheburrito 1 Link to comment
miketheburrito Posted June 6, 2016 Share Posted June 6, 2016 In most cases like this, the reason it works for some and not others is because the workflow has Alfred 2's directories hard-coded in it. If you still have your Alfred 2 directories (in ~/Library), it works. If not, it doesn't. You probably just need to open up the workflow's source code in an editor and change any occurrence of "Alfred 2" to "Alfred 3". That did the trick. There were 2 files in the workflow directory that had a couple hardcoded references to "Alfred 2" - changing them to "Alfred 3" fixed it. Thanks! Link to comment
macosxguru Posted June 9, 2016 Share Posted June 9, 2016 That did the trick. There were 2 files in the workflow directory that had a couple hardcoded references to "Alfred 2" - changing them to "Alfred 3" fixed it. Thanks! How did you achieve this? Is there a step-by-step procedure available anywhere? How does one edit a pre-existing workflow? Link to comment
miketheburrito Posted June 11, 2016 Share Posted June 11, 2016 How did you achieve this? Is there a step-by-step procedure available anywhere? How does one edit a pre-existing workflow? There may be a better way to do this, but this is what I did, and now the Caffeinate Control workflow works for me. I tried to make a step-by-step guide for you. Hope it helps! Step 1 Open up Alfred Preferences and go to the Workflows tab In your list of workflows, right click "Caffeinate Control" and do Open in Finder, like this: Step 2 Now you should have a Finder window open to the Caffeinate Control workflow directory, like this: I have highlighted the 2 files you will be editing: conf-and-help.scpt and library.sh Step 3 Open conf-and-help.scpt, which will launch the Script Editor Search for "Alfred", and you will find this line: Yours will say Alfred 2, so change it to Alfred 3 like in mine Save the script and quit the Script Editor Step 4 Open library.sh in a text editor (I used Sublime Text, but TextEdit or any other text editor is fine) Search for "Alfred", and you will find these 2 lines: Yours will say Alfred-2 and Alfred 2, so change them to Alfred-3 and Alfred 3 like in mine Save the file and quit your text editor That's it! Now the Caffeinate Control workflow should be working again (Note: after completing these steps, you might have to quit Alfred and then restart Alfred, but I'm not sure if that's necessary - I can't remember if I had to do that or not, but if it's still not working for you, then try that.) deanishe 1 Link to comment
deanishe Posted June 12, 2016 Share Posted June 12, 2016 (Note: after completing these steps, you might have to quit Alfred and then restart Alfred, but I'm not sure if that's necessary - I can't remember if I had to do that or not, but if it's still not working for you, then try that.) It should never be necessary to restart Alfred after changing a workflow unless your workflow has serious bugs and quitting Alfred is the only way to stop it. Link to comment
rice.shawn Posted June 12, 2016 Share Posted June 12, 2016 Damn. Just report these bugs to me, and I'll take care of them. This is an insanely old workflow that existed before the environmental variables were introduced, so I had to hardcode the paths. I'll update them. Link to comment
deanishe Posted June 12, 2016 Share Posted June 12, 2016 Damn. Just report these bugs to me, and I'll take care of them. This is an insanely old workflow that existed before the environmental variables were introduced, so I had to hardcode the paths. I'll update them. Wouldn't have helped with the app name in the AppleScript though Link to comment
rice.shawn Posted June 12, 2016 Share Posted June 12, 2016 Wouldn't have helped with the app name in the AppleScript though That's exactly what I'm debugging right now... trying to get the system variable and convert it to a path in AS. Damn, it's been a while since I've touched AS. Link to comment
deanishe Posted June 12, 2016 Share Posted June 12, 2016 (edited) Forget it. You can't. (Well, I couldn't figure it out). You can't use a variable as the target of a tell and if you include tell Alfred 2 and tell Alfred 3 in the same script, it'll complain if both apps aren't installed and ask the user to locate the missing one I think you have to either use duplicate scripts with the number changed or rewrite in JS, where you can use a variable in var app = Application('Alfred ' + version) Or generate the AppleScript using a proper language. Edited June 12, 2016 by deanishe Link to comment
rice.shawn Posted June 12, 2016 Share Posted June 12, 2016 The AS just runs a quick pop-up for the configuration, so that problem does not apply. There is no tell Alfred 2 or Alfred 3 in there (unless I'm totally forgetting something from code that I wrote three years ago -- total possibility). (Although you could get around that problem by checking to see if they are installed, and wrapping the tell statements in an if, etc...) deanishe 1 Link to comment
deanishe Posted June 12, 2016 Share Posted June 12, 2016 Ah, right, yeah. It's just a path, isn't it? Duh! Link to comment
macosxguru Posted June 12, 2016 Share Posted June 12, 2016 Thank you very much for the step by step guide. That was very helpful and it works fine now. macosxguru Link to comment
rice.shawn Posted June 12, 2016 Share Posted June 12, 2016 Crap. So I need to get back to work (deadline tomorrow; needing to do crap over the weekend). And I didn't manage to refresh my AS quick enough to fix the AS in the configure script. I'll get back to that after I push the final changes on the work deadline. For now, I pushed some changes to the git repo; but I need to get on an old computer with Alfred 2 in order to export it and not break others' installations. Will do that and post here after I fix the AS problem. 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