Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Chrome extension resources
- ; * Link url (ctrl+c): https://chrome.google.com/webstore/detail/copy-link-address/kdejdkdjdoabfihpcjmgjebcpfbhepmh
- ; * Link text (alt+shift+c): https://chrome.google.com/webstore/detail/copy-link/mjpbijfgaajfmabmfnabchojdlpfnbbi
- ; * Copy current url (alt+x): https://chrome.google.com/webstore/detail/copy-url/mkhnbhdofgaendegcgbmndipmijhbili
- ; * Copy url (alt+c): https://chrome.google.com/webstore/detail/copy-2-clipboard-with-eas/hiiobhaaokpmdmkkcaokdlanlemmcoah
- ; * Copy URL (alt+c): https://chrome.google.com/webstore/detail/copy-url/cmimjipjncmkldkeffkiebkijekcjnjd
- #IfWinActive, Chrom
- F1::
- ^d::
- title := "unknown" ; default title
- url := "http://www.example.com" ; default url
- ; https://autohotkey.com/board/topic/47789-how-to-check-if-a-directory-exists/
- If( InStr( FileExist("I:\Bookmark"), "D") )
- defdir := "I:\Bookmark" ; default target
- else
- defdir := "D:\"
- Clipboard:= ; clear clipboard
- ; Prepare directory path
- ; find current opened folder
- If WinExist("ahk_class CabinetWClass")
- dir := WinGetPath("ahk_class CabinetWClass")
- if InStr(dir, "Search Results")
- dir := defdir
- ; CASE 1: HOVER COPY
- ; * prepare url
- send, ^c ; get url
- Sleep, 100
- url := Clipboard
- Clipboard:=
- ; * prepare title
- send, !+c ; get title
- Sleep, 200
- title := Clipboard
- Clipboard:=
- if (url == "") ; hover link is not exist
- {
- ; CASE 2: COPY CURRENT URL
- ; prepare current tab link
- ; * get title
- WinGetTitle, title, A
- ; * get url
- If WinActive("Chrome Web Store") or WinActive("Cửa hàng")
- {
- Send, !d ; Highlight url
- Sleep, 100
- Send, ^c ; Copy url
- dir := "I:\Extensions"
- }
- else ; Other pages
- {
- Send, !c ; !x ; COPY URL extension shortcut key
- }
- Sleep, 100 ; Wating for clipboard
- url := Clipboard
- }
- else ; hover link is detected
- {
- if (title == "") ; copy title above is unsuccessful
- {
- ; try to get title
- send, {shift down}{Rbutton}{shift up}
- Sleep, 200
- send, {down}
- send, c
- Sleep, 100
- title := Clipboard
- }
- }
- ; Title format acceptized
- StringReplace, title, title, ", ', All
- StringReplace, title, title, *, •, All
- StringReplace, title, title, :, ÷, All
- StringReplace, title, title, /, ¦, All
- StringReplace, title, title, |, ¦, All
- StringReplace, title, title, ?, ¿, All
- StringReplace, title, title, `n, %A_Space%~%A_Space%, All
- ; Write links to folder
- IniWrite, %url%, %dir%\%title%.url, InternetShortcut, URL
- ; Alert
- ToolTipFont("s10", "")
- if (Title != "" && Url != "")
- ToolTipColor("white", "green")
- else if (Title == "")
- ToolTipColor("yellow", "red")
- else if (Url == "")
- ToolTipColor("orange", "red")
- ToolTip, ● Saved to %dir% |`n● Title = %title% |`n● Url = %url% |, 20, A_ScreenHeight - 100
- Sleep, 1000
- ToolTip
- return
- #IfWinActive
Add Comment
Please, Sign In to add comment