Jump to content

mellow

Member
  • Posts

    3
  • Joined

  • Last visited

Posts posted by mellow

  1. There was a post from a while back that worked for me until a few months ago. We had a new shared drive installed and the old Alfred workflow doesn't work anymore.

     

    This was the old code:

    ----

    path = "{query}"
    unc = ""
     
    if (path.start_with?('smb:'))
    # smb://NetworkDrive.corp.YYYY.com/Files/Folder/Folder
     
    parts = path.split('//') # ["smb:", "NetworkDrive.corp.YYYY.com/Files/Folder/Folder"]
    path_parts = parts[1].split('/') # ["NetworkDrive.corp.YYYY.com", "Files", "Folder", "Folder"]
    server_parts = path_parts[0].split('.')         # ["NetworkDrive", "corp", "YYYY", "com"]
    unc = "\\\\#{server_parts[0]}\\#{path_parts[1..-1].join('\\')}"
    else
    # afp://NetworkDrive/Folder/Folder/
     
    parts = path.split('//') # ["afp:", "NetworkDrive/Folder/Folder"]
    path_parts = parts[1].split('/') # ["NetworkDrive", "Files", "Folder", "Folder"]
    unc = "\\\\#{path_parts.join('\\')}"
    end
     
    puts unc
    ----
     
    The above old code gives something like this:

    \\10\Department\....
     
    What I now need is something that turns an OS X smb file path into the following:
     
    file:////tnx3k/Department/....

    Any help would be greatly appreciated!
     
     
     

     

  2. I'm a new to Alfred workflows as of today after finding this post through a quick google search. This is something I'm dying to get working, but I'm having an issue. 

     

    Created the workflow with Keyword "Share" with argument required > Connected to Ruby script and pasted the above > Connected to copy to clipboard

     

    Basically, I want to highlight the folder on the shared drive in finder, copy the location and send that link to the people in my department who are on PCs. When I launch alfred and type the keyword, the alfred launcher remains on the screen and it looks like the script isn't running. Nothing copied to the clipboard. 

     

    What am I forgetting in the process? Thanks for the help in advance.

     

    ---

     

    Never mind. I think I figured it out. I was missing a key step like pasting the smb location into the alfred window. Now, is there a way to create a workflow that copies the smb location of a folder or file to the clipboard so I don't have to right click > get info > manually copy smb location?

×
×
  • Create New...