Applescript单击';共享dropbox链接';使用上下文菜单
我正在尝试使用AXShowMenu访问特定dropbox文件夹中特定文件的上下文菜单中的“共享dropbox链接”项 我找到了以下脚本。通过 这似乎对桌面项目起到了作用Applescript单击';共享dropbox链接';使用上下文菜单,applescript,dropbox,Applescript,Dropbox,我正在尝试使用AXShowMenu访问特定dropbox文件夹中特定文件的上下文菜单中的“共享dropbox链接”项 我找到了以下脚本。通过 这似乎对桌面项目起到了作用 但是我如何使用它来定位文件夹中的特定文件,然后单击上下文菜单中的“共享dropbox链接”?有点笨拙,但它确实有效。这要求您在Finder中打开dropbox文件夹并放在最前面 tell application "Finder" activate --brings Finder to front select i
但是我如何使用它来定位文件夹中的特定文件,然后单击上下文菜单中的“共享dropbox链接”?有点笨拙,但它确实有效。这要求您在Finder中打开dropbox文件夹并放在最前面
tell application "Finder"
activate --brings Finder to front
select item 1 of window 1 --selects the first item in the list ; not sure how you want to select/determine the item
end tell
delay 0.5 --this is to insure you don't get unwanted typing in script editor (makes sure Finder activates before kludgey typing gets done)
tell application "System Events"
tell application process "Finder"
set _selection to value of attribute "AXFocusedUIElement" --focused element (selected element)
tell _selection to perform action "AXShowMenu" --contextual menu
end tell
keystroke "share dropbox link" --type to select contextual menu item
keystroke return --select it by hitting return
end tell
[编辑]以下是确保dropbox文件夹处于打开状态且位于查找器最前面的技巧:
tell application "Finder"
activate --brings Finder to front
tell me to set dbFolder to POSIX file ((do shell script "cd ~/Dropbox/;pwd") & "/")
open dbFolder
select item 1 of window 1 --selects the first item in the list ; not sure how you want to select/determine the item
end tell
tell application "System Events"
tell application process "Finder"
set _selection to value of attribute "AXFocusedUIElement" --focused element (selected element)
tell _selection to perform action "AXShowMenu" --contextual menu
end tell
keystroke "share dropbox link" --type to select contextual menu item
keystroke return --select it by hitting return
end tell
也许还有另一种选择上下文菜单的方法,但这就是我在深夜喝了一杯葡萄酒后想到的 此外,在执行此操作之前,您确实应该检查dropbox应用程序是否正在运行。
tell application "Finder"
activate --brings Finder to front
tell me to set dbFolder to POSIX file ((do shell script "cd ~/Dropbox/;pwd") & "/")
open dbFolder
select item 1 of window 1 --selects the first item in the list ; not sure how you want to select/determine the item
end tell
tell application "System Events"
tell application process "Finder"
set _selection to value of attribute "AXFocusedUIElement" --focused element (selected element)
tell _selection to perform action "AXShowMenu" --contextual menu
end tell
keystroke "share dropbox link" --type to select contextual menu item
keystroke return --select it by hitting return
end tell