2013-03-12 2 views
2

나쁜 영어로 죄송합니다.숨겨진 폴더 내용에 applescript 사용

나는 폴더 액션

on opening folder This_Folder 
repeat 
tell application "Finder" 
set dialogresult to display dialog "Restricted Folder. Please enter the password to access folder:" buttons {"Ok", "Close"} default button 1 default answer "" with hidden answer 
copy the result as list to {PWText, button_choice} 
set button_choice to the button returned of dialogresult 
if button_choice is equal to "Ok" then 
set PWText to the text returned of dialogresult 
if not PWText = "123456" then -- password 
display dialog "Access Denied" buttons {"Ok"} default button 1 
else 
display dialog "Access Granted" buttons {"Ok"} default button 1 
exit repeat 
end if 
else if button_choice is equal to "Close" then 
tell application "Finder" 
close folder This_Folder 
exit repeat 
end tell 
end if 
end tell 
end repeat 
end opening folder 

를 사용하여 암호로 보호 된 폴더에 AppleScript로를 발견하지만 난 폴더를 열려면 시작을 클릭 할 때, 그들이 그것을 보호하기 위해 대화 상자가 표시됩니다 그 후, 먼저이 폴더의 모든 항목을 숨겨 싶어요 폴더에 입력하고 수정 된 암호를 입력하면 모든 항목이 다시 표시됩니다. 쉘 스크립트 chflags 숨김 및 nohidden 실행할 필요가 있지만 첫 코드를 코딩하는 방법을 모릅니다.

나는

set selectionList to select every item in front window as list 
repeat with i from 1 to number of items of the selectionList 
set selectedItem to item i of the selectionList 
set posixPath to POSIX path of (selectedItem as string) as string 
do shell script "chflags nohidden \"" & posixPath & "\"" 
end repeat 

을 사용하려고하지만 난 숨겨진 파일을 표시해야 할 때, 코드 쇼는 모든 파일 :(

답변

0

시도 선택 캔트 :

set myFolder to POSIX path of (choose folder) 
do shell script "find " & quoted form of myFolder & " \\! -name \".*\" -type f -print0 | xargs -0 chflags nohidden" 

또는

set myFolder to POSIX path of (choose folder) 
do shell script "find " & quoted form of myFolder & " \\! -name \".*\" -type f -print0 | xargs -0 chflags hidden" 
+0

와우, 지금 고마워. 고마워. – nemtabi

+0

폴더를 숨기려면 -type f를 제거하십시오. – adayzdone

관련 문제