Ошибка вызвана выражением info for item i of trash
.Подвыражение item i of trash
возвращает объект элемента (Finder).Однако для команды info for
требуется псевдоним или ссылка на файл (см. Руководство по языку AppleScript ).
Существует два способа исправить выражение.Явно приведите элемент к псевдониму, например:
repeat with i from 1 to the (count of items) in trash
set this_info to get info for (item i of trash as alias)
set the total_size to the total_size + (size of this_info)
end repeat
Или вместо использования команды info for
просто используйте свойство size
элемента Finder:
repeat with i from 1 to the (count of items) in trash
set the total_size to the total_size + (size of item i)
end repeat
Убедитесь, чточтобы и RBPFMS
, и free_space
были объявлены как глобальные переменные в функции check
:
on check()
global RBPFMS
global free_space
...
end
Еще одна ошибка: поместите скобки вокруг RBPFMS as string
в операторе display alert
:
display alert "Size Limit Exceeded" message "The Recycle Bin cannot receive any more items because it can only use " & (RBPFMS as string) & " of your hard drive." buttons {"OK"} default button 1