Applescript计算子文件夹中的文件不起作用

时间:2010-09-03 10:50:56

标签: applescript

我似乎无法让这个工作。如果有人可以提供帮助或照亮它会很棒吗?

由于

on adding folder items to thisFolder after receiving thisItem

 try

  -- This gives you the name of the route folder, and the name of the added folder
  set folderName to name of (info for thisFolder)
  set itemName to name of (info for thisItem)

      -- I am trying to find out how many items the new folder that has been added to the route folder has but none of the variables below work
  -- Example: Route Folder > New Folder > # of files in new folder?
  set the numberOfFiles to the number of items in itemName
  set fileCount to (count (info for thisItem))
  set the item_count to the number of items in thisItem

  -- Dialog box to show information
  set the alert_message to (the folderName as text) & return & (the itemName as text) & return & (the item_count as text) as Unicode text
  display dialog the alert_message

 end try
end adding folder items to

1 个答案:

答案 0 :(得分:1)

如果thisItem是您添加的文件夹,请执行此操作...

tell application "Finder"
    if kind of thisItem is "Folder" then
        set itemsInTheFolder to items of thisItem
        set folderCount to count of itemsInTheFolder
    end if
end tell