2011-11-29 2 views
0

내 자동화 워크 플로우에 다음과 같은 애플 스크립트를 사용하고 있습니다 :새 파일 목록을 만들고이를 반환하는 방법은 무엇입니까?

on run {input, parameters} 
    --say input 
    set result_array to {} as list 
    try 
     repeat with this_file in input 
      tell application "Image Events" 
       launch 
       set this_image to open this_file 
       copy dimensions of this_image to {W, H} 
       close this_image 
      end tell 

      set text item delimiters to ":" 
      set file_name to last text item of (this_file as string) 
      set text item delimiters to "" 
      set filter_string to W & "x" & H as string 

      if file_name contains filter_string then 
       set the end of result_array to this_file 
      end if 
    end repeat 
    return result_array 
    on error error_message 
     display dialog error_message 
    end try 
end run 

스크립트 것은 Get Folder Contents 조치 후 실행됩니다.

결과 배열에 문제가 있지만 무엇을 알아낼 수 없습니다. 결과는 이름에 크기가있는 파일 목록이어야합니다.

+0

더 자세히 설명해주세요. – gadgetmo

+0

'result_array'에서 특정 'this_file'을 원하지만 작동하지 않습니다. – Phil

답변

2

내가 제대로 다음 중 하나를 사용 이해하는 경우 :

if file_name contains filter_string then 
-- set the end of result_array to this_file as alias 
-- set the end of result_array to this_file as text 
end if 

는 현재 this_file 파일의 원래 목록에 대한 포인터처럼입니다. 직접 사용하면 현재 값의 색인과 전체 목록이 포함됩니다.

이것은 아마도 repeat with a in b이 AppleScript로 구현 된 방법 때문일 수 있습니다.

+0

감사! 이게 내가 필요한거야. :) – Phil

관련 문제