set myURL to "No browser active"
set nameOfActiveApp to (path to frontmost application as text)
if "Safari" is in nameOfActiveApp then
tell application "Safari"
set myURL to the URL of the current tab of the front window
end tell
else if "Chrome" is in nameOfActiveApp then
tell application "Google Chrome"
set myURL to the URL of the active tab of the front window
end tell
end if
display dialog (myURL)
2条答案
按热度按时间5anewei61#
你可以像这样使用Apple Script:
xriantvc2#
使用AppleScript的Swift方案