2010-05-16 115 views

回答

1

文件夾的解決方案是use a catalog iterator以獲取文件夾中每個項目的Finder信息。 Finder信息是一個FileInfoFolderInfo結構,其中包含指定圖標出現位置的QuickDraw Point(積分座標,原點左上角,正下方)。

雖然,我不知道你會如何做到這一點的桌面。 Home文件夾中有一個Desktop文件夾,但檢查其內容可能會讓您找到Finder將用於在窗口中顯示該文件夾的位置。它也可能不包括桌面文件夾中沒有的任何內容,例如裝入的卷。

0

下蘋果腳本將獲得這些職位(請使用腳本橋或NSAppleScript)

tell application "Finder" 
    tell every item of desktop 
     get position 
     get name 
    end tell 
end tell 
+0

不適用於我。我得到-1,每個圖標-1。 – 2012-07-11 22:47:06

+0

對不起,有一個硬編碼的路徑指向我的桌面。通過指向「桌面」來修復它 – 2013-08-14 10:10:01

+0

它工作?然後,您可以將問題標記爲已回答。 – 2013-11-11 17:16:44

3

試試這個的AppleScript代碼

tell application "Finder" 
    get desktop position of every item of desktop 
end tell 
0

另一種解決方案(非常類似於@Vaskravchuk的一個)

tell application "Finder" 
    repeat with anItem in desktop 
     get {desktop position, name} of anItem 
    end repeat 
end tell