0
我有一個AppleScript導出爲.app文件,因爲我需要它在日誌運行到AppleScript的相對路徑導出爲的.app
這是我的代碼:
repeat
tell application "System Events"
repeat with desktopNumber from 1 to count of desktops
tell desktop desktopNumber
set picture to "~/Desktop/script/img.jpg"
end tell
end repeat
end tell
end repeat
的路徑腳本是〜/桌面/腳本/ script.app /內容/資源/腳本/ main.scpt
我想將圖像放在資源文件夾以及相關的路徑,所以我可以把文件夾在任何地方,而不會改變我的腳本,所以我試過
set desktopPicture to ((container of container of (path to me)) as text) & "/img.jpg"
repeat
tell application "System Events"
repeat with desktopNumber from 1 to count of desktops
tell desktop desktopNumber
set picture to desktopPicture
end tell
end repeat
end tell
end repeat
但是,這給我的錯誤Can’t make container of container of alias \"Macintosh HD:Users:Me:Desktop:script:script.app:Contents:Resources:Scripts:main.scpt\" into type text.