Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; ctrl+y = Go to the WaniKani page for the current Radical, Kanji, or Vocabulary
- ;; Likely to have some bugs.
- ;; Does not work for some radicals and must have made a guess and opened the info for radicals during reviews
- ;; Kanji and Radicals are untested for Lessons
- ;; Made a proposed fix for lessons pages and optimized the script to do only what's necessary
- SetTitleMatchMode 2
- #If WinActive("WaniKani / Reviews") || WinActive("WaniKani / Lessons")
- ~^y::
- site :=
- ClipSaved := ClipboardAll
- clipboard :=
- MouseGetPos, mouseX, mouseY
- IfWinActive WaniKani / Lessons
- Click 856, 359
- Else
- Click 1317, 361
- MouseMove, mouseX, mouseY
- Send, {Ctrl Down}ac{Ctrl Up}
- ClipWait
- Send {tab 3}
- page := clipboard
- VocabCheck :=
- VocabCheck := RegExReplace(page, "si).*\n([〜\p{Han}\p{Katakana}\p{Hiragana}]+).*(Vocabulary).*", "$2")
- If (VocabCheck = "Vocabulary")
- {
- Vocab :=
- Vocab := RegExReplace(page, "si).*\n([〜\p{Han}\p{Katakana}\p{Hiragana}]+).*(Vocabulary).*", "$1")
- site = vocabulary/%Vocab%
- ; Send ^{t}
- ; Sleep 20
- ; Send https://www.wanikani.com/vocabulary/%Vocab%
- ; Sleep 5
- ; Send {enter}
- }
- Else
- {
- RadCheck :=
- RadCheck := RegExReplace(page, "si).*\n([\p{Han}]+)\r\n(Radical).*(User Synonyms).*", "$2")
- If (RadCheck = "Radical")
- {
- Rad :=
- Rad := RegExReplace(page, "si).*\n([\w ]+).*(User Synonyms).*", "$1")
- Rad := RegExReplace(Rad, "(\w)", "$l1")
- Rad := RegExReplace(Rad, "(\s)", "-")
- site = radicals/%Rad%
- ; Send ^{t}
- ; Sleep 20
- ; Send https://www.wanikani.com/radicals/%Rad%
- ; Sleep 5
- ; Send {enter}
- }
- Else
- {
- KanjiCheck :=
- KanjiCheck := RegExReplace(page, "si).*\n([\p{Han}]+).*(Kanji).*", "$2")
- If (KanjiCheck = "Kanji")
- {
- Kanji :=
- Kanji := RegExReplace(page, "si).*\n([\p{Han}]+).*(Kanji).*", "$1")
- site = kanji/%Kanji%
- ; Send ^{t}
- ; Sleep 20
- ; Send https://www.wanikani.com/kanji/%Kanji%
- ; Sleep 5
- ; Send {enter}
- }
- }
- }
- Send ^{t}
- Sleep 20
- Send https://www.wanikani.com/%site%
- Sleep 5
- Send {enter}
- Clipboard := ClipSaved ; puts the original clipboard contents back
- Return
- #If ; default
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement