我有一个将文件通过网络移动到我的MAC计算机(CSV文件)的系统,该文件对于提供本地系统是必不可少的,但有时人们会忘记发送或生成它,因此我需要在我的计算机上显示“小心,您的文件夹中没有文件”
拥有POP UP是个不错的选择,此脚本应每2秒运行一次,它应显示一个按钮以关闭消息。
关于如何使用applescripts进行操作的任何想法?有人有示例代码吗?
您可能正在寻找这样的东西:
set POSIXpath to "/path/of/file"
set POSIXfile to POSIXpath & "file.csv"
set theAlias to POSIX file POSIXfile
tell application "Finder"
repeat
--The next line is optional
if exists process "Application of CSV file" then
if not (exists theAlias) then
--display alert
display alert "Warning: the file does not exist"
end if
end if
delay 5
end repeat
end tell
我包括的可选行可以用来检查文件所使用的任何应用程序的过程。因此,例如:
if exists process "Numbers" then
这首先检查以查看应用程序“ Numbers”当前是否正在运行。如果选择不检查申请流程,则删除该行和一条end if
语句。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句