我是Xcode的新手,也是AppleScript的新手
我只需要在Xcode应用程序中运行AppleScript。
Bassically,应用程序正在从Excel的URL列表中下载图片,并根据Excel中的列表重命名文件
以下是applescript代码:
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
答案 0 :(得分:1)
在Xcode中,您可以使用“Cocoa-AppleScript”模板在AppleScript中编写完整的应用程序。此外,您可以使用NSAppleScript类编译和执行AppleScript。如果您的问题只是制作AppleScript可执行文件,请在“脚本编辑器”中使用“另存为...”并将AppleScript保存为应用程序。
HTH