基于Applescript的Mac OS应用程序

我是Xcode的新手,也是AppleScript的新手

我需要的只是在Xcode应用程序中运行AppleScript。 这可能吗 ?

低俗的是,该应用程序正在下载Excel中的URL列表中的图片,并根据Excel中的列表重命名文件

提前致谢 ! 来自德国的问候 !

这是苹果的代码:

tell application "Microsoft Excel" set filenames to value of every cell of range "K3:K200" of sheet "Image_Moves" of document 1 set URLs to value of every cell of range "L3:L200" of sheet "Image_Moves" of document 1 end tell repeat with i from 1 to count URLs if (item i of filenames is not missing value) and (item i of URLs is not missing value) then set thisFname to quoted form of (POSIX path of ({path to desktop, "Image_Moves:"} as text) & item i of filenames) set thisUrl to quoted form of item i of URLs set status to (do shell script "curl -s -o " & thisFname & space & thisUrl) end if end repeat try tell application "Finder" delete (every item of folder ("Image_Moves") whose name begins with "0") end tell on error display dialog ("Error. Couldn't Move the File") buttons {"OK"} end try 

在Xcode中,您可以使用“Cocoa-AppleScript”模板在AppleScript中编写完整的应用程序。 另外,您可以使用NSAppleScript类编译和执行AppleScript。 如果您的问题只是制作AppleScript可执行文件,请在脚本编辑器中使用“另存为…”,然后将AppleScript保存为应用程序。

HTH