Applescript:将选择(文件夹)复制到桌面并将文件夹移动到其他位置
Applescript: Duplicate selection (folder) to desktop and moving the folder to a different location
首先,我是一个 applescript 菜鸟;-) 我要求的很简单,但我无法执行。请参阅下面的脚本。
tell application "Finder"
set selected_items to selection
set the defaultPath to path to desktop folder as alias
duplicate selection to defaultPath
--I want to take take selection variable that is duplicated to the desktop and move that folder icon to the bottom of my screen.
set desktop position of selection to {1400, 1200}
end tell
Here is the error I get ----> error "Finder got an error: Can’t set desktop position of selection to {1400, 1200}." number -10006 from desktop position of selection
在这个例子中,我选择了 1 个名为“12345_SomeFile”的文件夹。我希望能够使用选择变量来执行其他操作,例如移动、打开和将 window 移动到特定位置。希望这是有道理的。
非常感谢任何帮助,并提前致谢。
selection
returns 所选项目的列表,因此我假设您要复制所选项目的第一项。
我还假设桌面的设置 sorted by
设置为 none
tell application "Finder"
set selected_items to selection
if selected_items is not {} then
set newItem to duplicate item 1 of selected_items to desktop
set desktop position of newItem to {1400, 1200}
end if
end tell
首先,我是一个 applescript 菜鸟;-) 我要求的很简单,但我无法执行。请参阅下面的脚本。
tell application "Finder"
set selected_items to selection
set the defaultPath to path to desktop folder as alias
duplicate selection to defaultPath
--I want to take take selection variable that is duplicated to the desktop and move that folder icon to the bottom of my screen.
set desktop position of selection to {1400, 1200}
end tell
Here is the error I get ----> error "Finder got an error: Can’t set desktop position of selection to {1400, 1200}." number -10006 from desktop position of selection
在这个例子中,我选择了 1 个名为“12345_SomeFile”的文件夹。我希望能够使用选择变量来执行其他操作,例如移动、打开和将 window 移动到特定位置。希望这是有道理的。
非常感谢任何帮助,并提前致谢。
selection
returns 所选项目的列表,因此我假设您要复制所选项目的第一项。
我还假设桌面的设置 sorted by
设置为 none
tell application "Finder"
set selected_items to selection
if selected_items is not {} then
set newItem to duplicate item 1 of selected_items to desktop
set desktop position of newItem to {1400, 1200}
end if
end tell