Jump to content

Workflow help: Highlight Windows server path, convert to smb:// path, and open location


Recommended Posts

All--

 

I have spent quite a bit of time over the past day or so trying to figure this one out without success.

 

The goal of this workflow is to do the following:

  • Highlight a Windows server path like \\filesrv01\folder\folder2
  • Convert it to smb://filesrv01/folder/folder2
  • Open this folder location

In case it matters, the server to which I will be navigating does us AD authentication.

 

So far, I have gotten as far as using the following workflow to convert the path: http://cloud.dferg.us/pkSA

 

I had to change the script a bit to the following:

path = "{query}"
unc = ""

parts = path.split('\\')
parts.delete_at(0)
unc = parts.join('/')

print "smb:/#{unc}"

 

Now that I have the correct form of the path, I cannot figure out how to just simply launch this. I would really rather avoid having to activate finder, hit command K, and then paste in the path.

 

Some topics I have combed through on the forum are:

 

http://www.alfredforum.com/topic/180-connecting-to-remove-servers/

http://www.alfredforum.com/topic/1248-mount-network-shares-with-automatic-discovery/

 

Any help would be appreciated.

 

Thanks,

Dan

Link to comment

Nevermind all. I actually figured this one out :D

 

I just needed to add an osascript that did the following within the convert path workflow linked above:

 

tell application "Finder"
    activate
    tell application "System Events" to key code 40 using command down
    tell application "System Events" to key code 9 using command down
    tell application "System Events" to key code 36
end tell

 

This opens Finder, hits Command K, hits Command V, and then hits Enter.

 

I found the key codes by using the KeyCodes app here: http://manytricks.com/keycodes/

 

I hope this helps others out.

Link to comment
  • 2 weeks later...

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
×
×
  • Create New...