Ejemplo n.º 1
0
def main(q):
    options = []
    paths = ""

    if q:
        paths = ", ".join(q[0].split("\t"))

    if len(q) > 1:
        options = q[1:]

    p = CopyAllPaths(paths)

    if options:
        if "-hfs" in options:
            paths = ((subprocess.check_output(
                ['osascript', 'posix_to_hfs.applescript', paths])).strip())
            if "-q" in options:
                paths = p.quotedPaths(paths, "hfs")
        else:
            if "-url" in options:
                paths = p.fileUrls()
            if "-s" in options:
                paths = p.shortPaths()
            if "-q" in options:
                paths = p.quotedPaths(paths)
            if "-p" in options:
                paths = p.posixPaths()

        if "-n" in options:
            paths = p.joinNewlines(paths)

    else:
        paths = p.strPaths()

    print paths
def main(q):
    options = []
    paths = ""

    if q:
        paths = ", ".join(q[0].split("\t"))

    if len(q) > 1:
        options = q[1:]

    p = CopyAllPaths(paths)

    if options:
        if "-hfs" in options:
            paths = ((subprocess.check_output(['osascript', 'posix_to_hfs.applescript', paths])).strip())
            if "-q" in options:
                paths = p.quotedPaths(paths, "hfs")
        else:
            if "-url" in options:
                paths = p.fileUrls()
            if "-s" in options:
                paths = p.shortPaths()
            if "-q" in options:
                paths = p.quotedPaths(paths)
            if "-p" in options:
                paths = p.posixPaths()

        if "-n" in options:
            paths = p.joinNewlines(paths)
        
    else:
        paths = p.strPaths()

    print paths
Ejemplo n.º 3
0
def main(q=False):

  paths = ((subprocess.check_output(['osascript', 'allpaths.applescript'])).strip()).decode("utf-8") # returns file urls string
  f_icon_name = "copypaths"

  if paths != "":
    p = CopyAllPaths(paths) #--> file ulrs array
    f_title = "Copy POSIX Paths as:"
    posixPaths = ((subprocess.check_output(['osascript', 'fileurl_to_posix.applescript', paths])).strip()).decode("utf-8")
    

    if q:
      
      if "-url" in q:
          f_title = "Copy File URLs as:"
          f_icon_name += "_url"
          
      elif "-hfs" in q:
          f_title = "Copy HFS Paths as:"
          f_icon_name += "_hfs"
          paths = ((subprocess.check_output(['osascript', 'fileurl_to_hfs.applescript', paths])).strip()).decode("utf-8")
          paths = unquote(paths)
          if "-q" in q:
              paths = p.quotedPaths(paths, "hfs")

      else:
          f_icon_name += "_posix"
          paths = unquote(posixPaths)
          if "-s" in q:
              paths = p.shortPaths()
              f_icon_name += "_short"
      
      if "-q" in q:
          f_icon_name += "_quoted"
          paths = p.quotedPaths(paths)
      
      
      if "-n" in q:
          paths = p.joinNewlines(paths)
        
    else:
      f_icon_name += "_posix"
      paths = unquote(posixPaths)
      
    f_sub = paths
    f_valid = "yes"

  else:
    f_icon_name += "_error"
    f_title = "Copy Paths:"
    f_sub = "Couldn't get any path"
    f_valid = "no"
  f_icon = f_icon_name + ".png"

  feedback = Feedback()
  feedback.addItem(title=f_title, subtitle=f_sub, valid=f_valid, arg=paths, icon=f_icon)
  print feedback