2010-05-16 112 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