Applescript自动打开下载的文件

Applescript自动打开下载的文件,applescript,Applescript,自动打开名为testfile的文件下载到下载文件夹并与testprogram一起运行时,Apple脚本应该是什么样子 我觉得它应该是一个非常简单的模板,我很难找到很多东西来完成它。此示例使用Microsoft Word打开testFile.rtf。使用您的信息更新代码,并将文件夹操作附加到目标文件夹 on adding folder items to theFolder after receiving theFiles set appPath to quoted form of (PO

自动打开名为testfile的文件下载到下载文件夹并与testprogram一起运行时,Apple脚本应该是什么样子


我觉得它应该是一个非常简单的模板,我很难找到很多东西来完成它。

此示例使用Microsoft Word打开testFile.rtf。使用您的信息更新代码,并将文件夹操作附加到目标文件夹

on adding folder items to theFolder after receiving theFiles

    set appPath to quoted form of (POSIX path of (path to applications folder) & "Microsoft Office 2011/Microsoft Word.app")

    repeat with aFile in theFiles
        tell application "Finder" to aFile's name = "testfile.rtf"
        if the result then
            set filePath to quoted form of aFile's POSIX path
            do shell script "open -a " & appPath & space & filePath
        end if
    end repeat
end adding folder items to
如果要手动打开文件,请尝试以下操作:

set appPath to quoted form of (POSIX path of (path to applications folder) & "Microsoft Office 2011/Microsoft Word.app")
set filePath to quoted form of (POSIX path of (path to documents folder) & "testFile.rtf")
try
    do shell script "open -a " & appPath & space & filePath
end try

此示例使用Microsoft Word打开testFile.rtf。使用您的信息更新代码,并将文件夹操作附加到目标文件夹

on adding folder items to theFolder after receiving theFiles

    set appPath to quoted form of (POSIX path of (path to applications folder) & "Microsoft Office 2011/Microsoft Word.app")

    repeat with aFile in theFiles
        tell application "Finder" to aFile's name = "testfile.rtf"
        if the result then
            set filePath to quoted form of aFile's POSIX path
            do shell script "open -a " & appPath & space & filePath
        end if
    end repeat
end adding folder items to
如果要手动打开文件,请尝试以下操作:

set appPath to quoted form of (POSIX path of (path to applications folder) & "Microsoft Office 2011/Microsoft Word.app")
set filePath to quoted form of (POSIX path of (path to documents folder) & "testFile.rtf")
try
    do shell script "open -a " & appPath & space & filePath
end try

您可以使用Automator创建如下文件夹操作:

Finder的
open
命令还有一个
,使用
说明符指定应用程序:

tell application "Finder"
    open POSIX file "/usr/share/doc/bash/bash.html" using (path to application "Safari")
end tell

您可以使用Automator创建如下文件夹操作:

Finder的
open
命令还有一个
,使用
说明符指定应用程序:

tell application "Finder"
    open POSIX file "/usr/share/doc/bash/bash.html" using (path to application "Safari")
end tell

什么?你想要一个AppleScript脚本,在下载后打开一个特定的文件,并带有一个特定的应用程序?什么?您想要一个AppleScript脚本,在下载特定文件后,用特定的应用程序打开该文件?