2016-07-29 48 views
0

的Mac OS的應用程序我是新來了Xcode作爲以及我對AppleScript的基於AppleScript的

所有我需要的是在Xcode應用程序運行AppleScript。這可能嗎 ?

Bassically,下載應用軟件從Excel中的一個URL列表圖片和重命名這些文件acording在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

不清楚你的問題是什麼。它與Xcode有什麼關係?什麼是Xcode應用程序? – Eiko

+0

Eiko,我有一個Applescript的版本,我想把它變成一個Mac OS的應用程序。它與Xcode有什麼關係?好吧,從我所知道的,你可以用X-Code來做到這一點,對吧? – AnotherUser31

回答

1

在Xcode中,你可以寫在AppleScript的與 「可可AppleScript的」 模板完整的應用程序。另外,您可以使用NSAppleScript類編譯和執行AppleScript。如果您的問題僅僅是製作AppleScript可執行文件,請在腳本編輯器中使用另存爲...並將AppleScript保存爲應用程序。

HTH

+0

謝謝SteffX,如果你可以幫助我用NSAppleScript類編譯我的Applescript,我會非常高興。請請求 – AnotherUser31