Steven_ Posted January 16, 2013 Share Posted January 16, 2013 Hi Firstly, this may be a feature that can be handled by the Worklows addition to Alfred, though I don't have the skills to create the required scripts... I spend a large amount of my day working off Servers. Either Windows 2003/2008 or Mac OSX Server. To access the servers I use the CMD + K shortcut to access the 'Connect to server' dialog, then choose the server I want to connect to etc etc. I'd really like to be able to invoke Alfred, type a keyword (maybe 'srv') along with the required server name and have that server mount and open in finder. Hope that makes sense, if anyone can do this with Workflows I'd love to know how they've made it happen! Cheers Steven Link to comment
jdfwarrior Posted January 16, 2013 Share Posted January 16, 2013 Steven, Since this was something that could more than likely be handled with a Workflow and isn't a request for a code Alfred feature, I moved this thread to the Workflow Creators forum. Thanks Link to comment
Kennon Posted January 16, 2013 Share Posted January 16, 2013 Very basic. Usage: -- srv smb://ServerName -- srv afp://ServerName http://d.pr/f/ITMw Link to comment
Steven_ Posted January 16, 2013 Author Share Posted January 16, 2013 Hi and thanks Ken that's great! I'd like to have a method of typing a abbreviation of the server name (without the smb/afp part) after srv to make it quicker. Using what you've given me and what I can find by googling aroundI'll see if I can work out the AppleScript for it. Will post back here if it works. Cheers Steven Link to comment
Kennon Posted January 16, 2013 Share Posted January 16, 2013 No problem. It was just something quick. I'll see if I can find some more information about doing what you want too. Link to comment
jdfwarrior Posted January 16, 2013 Share Posted January 16, 2013 One kinda of easy thing would be to make a workflow that will allow you to add locations/servers.. So do something like 'addserver smb://HTPC' and that would save it in a list. Then use 'srv <name>' and it would show a list of saved servers to select from. I can prob make it tonight it you want? Link to comment
jdfwarrior Posted January 16, 2013 Share Posted January 16, 2013 Here's a quick and dirty attempt. Literally did this in about 5 minutes If you want more, I'm sure I could accommodate. Just let me know.. Download Link to comment
Steven_ Posted January 17, 2013 Author Share Posted January 17, 2013 Hi both Thanks for your help, it really is much appreciated David, I've tried the workflow above. When I enter a server using 'addserver' I get an error message in Growl/Notification Centre. The error message is cut off due to it's length and the available space in the Notification Centre window, but it starts: New Server Warning: array_combine(): Both parameters should have an equal number of elements... Just to make sure I'm entering the data correctly, I input this into the 'addserver' workflow in Alfred: 'addserver afp://192.168.0.100' Once again, thanks for the help Steven Link to comment
jdfwarrior Posted January 17, 2013 Share Posted January 17, 2013 Yeah sorry I forgot to tell you how to enter them Use: Syntax addserver <name> <path> Example addserver file_server afp://127.0.0.1 My bad.. I added a "name" so you could have an easily recognizable name for the servers too if you wanted.. One downside to it is that it doesn't spaces in the name right now. I can fix that for you later if you'd like. Let me know if you get it working Link to comment
Steven_ Posted January 17, 2013 Author Share Posted January 17, 2013 David - works like a charm, thanks very much for all your help. I've taken a quick look at the PHP behind it, will digest over the next few days to get my head around what it's doing. All the best Steven Link to comment
jdfwarrior Posted January 17, 2013 Share Posted January 17, 2013 I'll give you a quick overview. addserver - Accepts the input and then splits it into an array based on <space> so it can grab the name and server values separately. It checks to see if servers.json exists. If so, adds the new entry to the servers list and writes it back to the json file. If the servers.json file doesn't exist, it makes a new array (the single, new server), and writes that to a new servers.json. Echos success. srv - Looks for the servers.json file. If it's there, it reads the file and formats the server list as xml for Alfred feedback. If the file doesn't exist, it returns a feedback item saying that no servers are available. Link to comment
Steven_ Posted January 17, 2013 Author Share Posted January 17, 2013 Once again, thanks David for your help and willingness to share - it really is very much appreciated. All the best Steven Link to comment
tconte Posted January 18, 2013 Share Posted January 18, 2013 How do I remove servers from the list? So when I type "srv" it stops showing an unused address? Thanks Link to comment
jdfwarrior Posted January 18, 2013 Share Posted January 18, 2013 How do I remove servers from the list? So when I type "srv" it stops showing an unused address? Thanks I didn't add that because it wasn't something that Steven_ originally asked for. I guess I could make a quick edit to remove one by typing 'srv' and in the list, highlight one and press cmd+enter. I'll try to get it posted later. Link to comment
ehrlund Posted January 18, 2013 Share Posted January 18, 2013 David, I just wanted to thank you for this workflow, since it's something I've been looking for a long time. Replaced my Keyboard Maestro script instantly. /P Link to comment
jdfwarrior Posted January 18, 2013 Share Posted January 18, 2013 Just made a little update to this to make it so that you could remove servers from the list. Just use the srv keyword to get your server list, highlight the server you want to delete, and press cmd+enter to delete it from the server list Download Adeiko 1 Link to comment
Adeiko Posted January 22, 2013 Share Posted January 22, 2013 Just made a little update to this to make it so that you could remove servers from the list. Just use the srv keyword to get your server list, highlight the server you want to delete, and press cmd+enter to delete it from the server list Download Man, you absolutely ROCK. At your feet :/_ Link to comment
OliverJAsh Posted January 27, 2013 Share Posted January 27, 2013 It would be awesome if you could type `srv <name> <volume>` and have Alfred filter the volumes on that server as an instant search. For example, I have these volumes on my NAS: http://cl.ly/image/2q101M1s2f2C That would mean I could type `srv nas media` to access the Media volume on my NAS. Link to comment
valon Posted February 2, 2013 Share Posted February 2, 2013 i use this: (Keyword>Run Apple Script) on alfred_script(q) tell application "Finder" open location "smb://username@server" end tell end alfred_script because I want to open location in Finder Link to comment
scottfwalter Posted February 2, 2013 Share Posted February 2, 2013 It would be awesome if you could type `srv <name> <volume>` and have Alfred filter the volumes on that server as an instant search. For example, I have these volumes on my NAS: http://cl.ly/image/2q101M1s2f2C That would mean I could type `srv nas media` to access the Media volume on my NAS. I have this script on alfred_script(argv) set myList to splitString(argv, " ") set numItems to count myList if numItems is less than 3 then display dialog "You need to pass at least 3 arguments" return end if set theServer to item 1 of myList set theUsername to item 2 of myList set thePassword to item 3 of myList set theVolume to item 4 of myList set theUrl to "afp://" & theUsername & ":" & thePassword & "@" & theServer if numItems is 4 then set theUrl to theUrl & "/" & theVolume end if --display dialog theUrl tell application "Finder" mount volume theUrl end tell end alfred_script to splitString(aString, delimiter) set retVal to {} set prevDelimiter to AppleScript's text item delimiters log delimiter set AppleScript's text item delimiters to {delimiter} set retVal to every text item of aString set AppleScript's text item delimiters to prevDelimiter return retVal end splitString The only problem is that it won't work if the volume has a space in it. I can't figure out how to escape a space when entering the query in Alfred OliverJAsh 1 Link to comment
scottfwalter Posted February 2, 2013 Share Posted February 2, 2013 It would be awesome if you could type `srv <name> <volume>` and have Alfred filter the volumes on that server as an instant search. For example, I have these volumes on my NAS: http://cl.ly/image/2q101M1s2f2C That would mean I could type `srv nas media` to access the Media volume on my NAS. I have this script on alfred_script(argv) set myList to splitString(argv, " ") set numItems to count myList if numItems is less than 3 then display dialog "You need to pass at least 3 arguments" return end if set theServer to item 1 of myList set theUsername to item 2 of myList set thePassword to item 3 of myList set theVolume to item 4 of myList set theUrl to "afp://" & theUsername & ":" & thePassword & "@" & theServer if numItems is 4 then set theUrl to theUrl & "/" & theVolume end if --display dialog theUrl tell application "Finder" mount volume theUrl end tell end alfred_script to splitString(aString, delimiter) set retVal to {} set prevDelimiter to AppleScript's text item delimiters log delimiter set AppleScript's text item delimiters to {delimiter} set retVal to every text item of aString set AppleScript's text item delimiters to prevDelimiter return retVal end splitString The only problem is that it won't work if the volume has a space in it. I can't figure out how to escape a space when entering the query in Alfred Link to comment
jdfwarrior Posted February 2, 2013 Share Posted February 2, 2013 Another issue with your request also would be that, if your remote location requires a password you can't grab a list of potential shares. If its wide open, it's a little easier Link to comment
jehrler Posted February 27, 2013 Share Posted February 27, 2013 This works amazingly well. Thanks. I was hoping to figure out how to use the exact same workflow but modify it to start screen sharing sessions. Unfortunately my php and bash knowledge are nil. Any experienced kind souls that might help? Link to comment
ctwise Posted March 6, 2013 Share Posted March 6, 2013 Just made a little update to this to make it so that you could remove servers from the list. Just use the srv keyword to get your server list, highlight the server you want to delete, and press cmd+enter to delete it from the server list Download Please change line 4 in addserver.php from: $input = explode( " ", $input ); to: $input = explode( " ", $input, 2 ); UNCs can have spaces in them. Link to comment
jdfwarrior Posted March 7, 2013 Share Posted March 7, 2013 Please change line 4 in addserver.php from: $input = explode( " ", $input ); to: $input = explode( " ", $input, 2 ); UNCs can have spaces in them. Awesome, will do. I've been using explode() forever and I thought I knew the full syntax so I had never looked back to notice there was a limit parameter. I'll get this added. 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