The other issue is that any other lines of code that involve my %clipboard% variable, the newly copied item does not get stored and it pastes the previous item instead. I don't understand why just based on the code below..
Code: Select all
OnClipboardChange("CleanLink") ;in auto-exe section
CleanLink() {
if !(InStr(Clipboard, "google.com") || InStr(Clipboard, "fbcdn.net") || RegExMatch(Clipboard, "\.[a-z]{2,4}/")) ; match any domain ending with 2 to 4 characters and a forward slash (if there's no /, then no cleaning is required)
return
OnClipboardChange("CleanLink", 0)
clipsave := ClipboardAll
if RegExMatch(Clipboard, "https://youtu.*?\K\d+$", Seconds) {
Time = 20210101000000
Time += Seconds, Seconds
FormatTime, Time, %Time%, H:mm:ss
Clipboard := Time
}
Clipboard := RegExReplace(Clipboard, "google.com.*\K&oq=.*")
Clipboard := RegExReplace(Clipboard, "(?<=search\?q=)[a-z\+]+", "%s")
Clipboard := StrReplace(Clipboard, "&source=lnt")
Clipboard := StrReplace(Clipboard, "?usp=sharing")
Clipboard := RegExReplace(Clipboard, "fbcdn.net.*\K&bytestart=.*")
if !Clipboard
Clipboard := clipsave
OnClipboardChange("CleanLink", 1)
}
Code: Select all
$^d:: ;Font Header RED
Click 3
OnClipboardChange("CleanLink", 0)
Sleep 200
SendInput ^d
WinWaitActive,Font ahk_exe Evernote.exe,,4
Sleep 300
If WinExist("Font ahk_exe Evernote.exe"){
SendInput {tab}Bold{tab}15
SendInput {tab 3}r{Enter}
ClipboardOld := ClipboardAll
Clipboard := ""
Sleep 1500
SendInput ^c
;SendInput {appskey}{Down 2}{Enter}
;SendInput {ctrl down}c{ctrl up}
msgbox, %clipboard%
}
return