DavidK Posted January 24, 2013 Share Posted January 24, 2013 Yesterday and today, I've been working on building a workflow to connect and disconnect from a remote VPN server. Somehow, I missed the fact that these forums existed until this afternoon, so I've been trying to learn from the few Alfred 2 workflows that were published on the Alfred blog. These forums would have made that learning process a bit quicker! Anyway, poking around the messages a bit this evening, I ran across Alfpt (awesome!), which led me to Sebastian Schöp's VPN Toggle Script which seems to already do what I'm trying to accomplish and seems very slick. I will likely just end up using his, however, I would like to ask a question about a problem I'm having with the the workflow I put together for my own education. The workflow I created shows all the available VPN servers that are set up on the system, and displays them as a list within Alfred. Once a certain profile is selected from the list, it will automatically connect to that particular server. That all works fine if I select the individual server using the arrow keys or the command-number shortcut. However, I am unable to get the fuzzy text match to work properly in my implementation. For instance, if the workflow keyword is "vpn" and I have the following VPN servers/names set up: USA EMEA APAC I would assume I could type "vpn e" and connect to the EMEA profile. However, it seems to be stuck on USA as the default selection for some reason, even adding the extra text. I've got "with space" checked and also set "Argument Optional". Any ideas or suggestions? https://dl.dropbox.com/u/318024/VPNConnection.alfredworkflow Thanks,Dave Link to comment
schoeps Posted January 24, 2013 Share Posted January 24, 2013 Here is the related Post: http://www.alfredforum.com/index.php?/topic/191-workflow-for-vpn-services/ Let me know, if an additional feature is necessary... Regarding your problem: You have to filter your results by yourself. Your script filter should check in the loop "for p in "${arr[@]}" whether "p" includes "{query}" and only return those items. Bye Sebastian Link to comment
DavidK Posted January 24, 2013 Author Share Posted January 24, 2013 Thanks for the tip Sebastian, I'll try to see if I can fix that. I do prefer your implementation, but am still just trying to learn! Speaking of that, how did you learn about the AppleScript to control the VPN components? Specifically, the "get name of every service whose (kind is greater than 8))"? I was originally going to use AppleScript, but with my limited understanding of the language, I couldn't find that specific command to return all of the VPN connections. Thanks! Dave 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