Created
November 18, 2021 14:22
-
-
Save treastrain/cb86595f1450c30cf11c47d358636438 to your computer and use it in GitHub Desktop.
Web ページのタイトルと URL をクリップボードにコピーする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
tell application "System Events" | |
set front_app to name of (path to frontmost application) | |
end tell | |
-- display notification front_app with title "Running applications" | |
if front_app is "Safari.app" then | |
tell application "Safari" | |
set theURL to URL of front document | |
set theTitle to name of front document | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Safari Technology Preview.app" then | |
tell application "Safari Technology Preview" | |
set theURL to URL of front document | |
set theTitle to name of front document | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Microsoft Edge.app" then | |
tell application "Microsoft Edge" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Microsoft Edge Beta.app" then | |
tell application "Microsoft Edge Beta" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Microsoft Edge Dev.app" then | |
tell application "Microsoft Edge Dev" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Microsoft Edge Canary.app" then | |
tell application "Microsoft Edge Canary" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Google Chrome.app" then | |
tell application "Google Chrome" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Google Chrome Beta.app" then | |
tell application "Google Chrome Beta" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Google Chrome Dev.app" then | |
tell application "Google Chrome Dev" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
else if front_app is "Google Chrome Canary.app" then | |
tell application "Google Chrome Canary" | |
set theURL to URL of active tab of first window | |
set theTitle to title of active tab of first window | |
set the clipboard to theTitle & " " & theURL as string | |
end tell | |
end if | |
display notification theTitle & " " & theURL as string with title "Copied 🔖" subtitle front_app | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment