2016-06-08 4 views
0

이 기사를 찾았습니다 ... http://www.guidingtech.com/26874/eject-delete-dmg-files-automatically/ 제 질문은 페이지의 두 번째 부분과 관련이 있습니다.휴지통에 넣을 때 OSX 볼륨 마운트 해제

엘 캡에서 더 이상 작동하지 않는 것 같습니다. 터미널의 개별 라인을 사용하려고 시도하고 "꺼내기"를 "분리"해야 할 필요가 있음을 알았습니다. detach 명령의 출력과 일치하도록 ###을 변경했지만 작동하지 않는 것 같습니다. 나는 자동화 도구에서 "워크 플로가 실행될 때이 동작 표시"를 선택하고 팝업을 표시하기 때문에 폴더 작업이 실행되고 있음을 알고 있습니다. 여기

내가 가진 무엇 :

import string, os, sys 

lines = os.popen("hdiutil info").readlines() 
should_eject = False 

for line in lines: 
    if line.startswith("image-alias"): 
     path = line.split(":")[1] 
     image_path = path.lstrip().rstrip() 
     if image_path in sys.argv: 
      should_eject = True 
     elif line.startswith("/dev/") and should_eject is True: 
      os.popen("hdiutil detach -force " % line.split()[0]) 
      should_eject = False 
     elif line.startswith("==="): 
      should_eject = False 
+0

아래 내 자신의 질문에 대답 – cycle4passion

답변

0
import string, os, sys 

lines = os.popen("hdiutil info").readlines() 
should_eject = False 

for line in lines: 
    if line.startswith("image-alias"): 
     path = line.split(":")[1] 
     image_path = path.lstrip().rstrip() 
     if image_path in sys.argv: 
      should_eject = True 
    elif line.startswith("/dev/") and should_eject is True: 
     os.popen("hdiutil eject %s" % line.split()[0]) 
     should_eject = False 
    elif line.startswith("==="): 
     should_eject = False 
관련 문제