Created
May 16, 2018 11:14
-
-
Save OKsign/ff135dff78d96175db9de171b3a1cf46 to your computer and use it in GitHub Desktop.
This file contains 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
-- clean copied link | |
delay 0.5 | |
set copT to the clipboard | |
-- google. | |
if copT contains "google." then | |
try | |
set AppleScript's text item delimiters to {"url="} | |
set Clean1 to text item 2 of copT | |
set AppleScript's text item delimiters to {"&usg="} | |
set Clean2 to text item 1 of Clean1 | |
-- search and replace - Clean2 | |
set prevTIDs to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to the "%3A" -- search | |
set the item_list to every text item of Clean2 -- original text | |
delay 0.04 | |
set AppleScript's text item delimiters to the ":" -- replace | |
set Clean3 to the item_list as string | |
set AppleScript's text item delimiters to prevTIDs | |
-- search and replace - Clean3 | |
set prevTIDs to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to the "%2F%2F" -- search | |
set the item_list to every text item of Clean3 -- original text | |
delay 0.04 | |
set AppleScript's text item delimiters to the "//" -- replace | |
set Clean4 to the item_list as string | |
set AppleScript's text item delimiters to prevTIDs | |
-- search and replace - Clean4 | |
set prevTIDs to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to the "%2F" -- search | |
set the item_list to every text item of Clean4 -- original text | |
delay 0.04 | |
set AppleScript's text item delimiters to the "/" -- replace | |
set Clean5 to the item_list as string | |
set AppleScript's text item delimiters to prevTIDs | |
-- end clean | |
-- if | |
if Clean5 contains "%3F" then | |
set prevTIDs to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to the "%3F" -- search | |
set the item_list to every text item of Clean5 -- original text | |
delay 0.04 | |
set AppleScript's text item delimiters to the "?" -- replace | |
set Clean5 to the item_list as string | |
set AppleScript's text item delimiters to prevTIDs | |
end if | |
if Clean5 contains "%3D" then | |
set prevTIDs to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to the "%3D" -- search | |
set the item_list to every text item of Clean5 -- original text | |
delay 0.04 | |
set AppleScript's text item delimiters to the "=" -- replace | |
set Clean5 to the item_list as string | |
set AppleScript's text item delimiters to prevTIDs | |
end if | |
if Clean5 contains "%26" then | |
set prevTIDs to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to the "%26" -- search | |
set the item_list to every text item of Clean5 -- original text | |
delay 0.04 | |
set AppleScript's text item delimiters to the "&" -- replace | |
set Clean5 to the item_list as string | |
set AppleScript's text item delimiters to prevTIDs | |
end if | |
-- end if | |
delay 0.2 | |
set the clipboard to Clean5 | |
delay 1 | |
tell application "System Events" | |
display notification "Done!" with title "Script 8" | |
end tell | |
return | |
end try | |
end if -- copT contains "google." | |
if copT contains "amazon." then | |
try | |
set AppleScript's text item delimiters to {"ref="} | |
set Clean1 to text item 1 of copT | |
delay 0.2 | |
set the clipboard to Clean1 | |
delay 1 | |
tell application "System Events" | |
display notification "Done!" with title "Script 8" | |
end tell | |
return | |
end try | |
end if -- copT contains "google." | |
if copT contains "?utm_" then | |
try | |
set AppleScript's text item delimiters to {"?utm_"} | |
set Clean1 to text item 1 of copT | |
delay 0.2 | |
set the clipboard to Clean1 | |
delay 1 | |
tell application "System Events" | |
display notification "Done!" with title "Script 8" | |
end tell | |
return | |
end try | |
end if -- copT contains "?utm_" | |
if copT contains "addons.mozilla" then | |
try | |
set AppleScript's text item delimiters to {"?src="} | |
set Clean1 to text item 1 of copT | |
delay 0.2 | |
set the clipboard to Clean1 | |
delay 1 | |
tell application "System Events" | |
display notification "Done!" with title "Script 8" | |
end tell | |
return | |
end try | |
end if -- copT contains "addons.mozilla" | |
if copT contains "youtube." then | |
try | |
if copT contains "feature=youtu.be&" then | |
set AppleScript's text item delimiters to {"feature=youtu.be&"} | |
set Clean1 to text item 1 of copT & text item 2 of copT | |
delay 0.2 | |
set the clipboard to Clean1 | |
delay 1 | |
tell application "System Events" | |
display notification "Done!" with title "Script 8" | |
end tell | |
return | |
end if | |
if copT contains "&app=desktop" then | |
set AppleScript's text item delimiters to {"&app=desktop"} | |
set Clean1 to text item 1 of copT | |
delay 0.2 | |
set the clipboard to Clean1 | |
delay 1 | |
tell application "System Events" | |
display notification "Done!" with title "Script 8" | |
end tell | |
return | |
end if | |
end try | |
end if -- copT contains "youtube." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment