Last active
September 28, 2021 19:24
-
-
Save JakubKoralewski/a9f4ca22d721b462803e85f921c97afb to your computer and use it in GitHub Desktop.
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
#SingleInstance Force | |
#Persistent | |
AutoTrim, Off | |
; menu | |
Menu, Tray, Add | |
Menu, Tray, Add, Ustaw okno jako przeglądarkę, ChooseBrowserWindow | |
; zapisuje obecne aktywne okienko jako przegladarke | |
ChooseBrowserWindow() { | |
global Browser | |
Browser := TryFindBrowserWindow() | |
} | |
SetTitleMatchMode, 2 | |
; probuje znalezc przegladarke | |
TryFindBrowserWindow() { | |
SetTitleMatchMode, 2 | |
ReturnValue := false | |
for _, B in ["Mozilla Firefox", "Chrome", "Microsoft Edge"] { | |
if WinExist(B) { | |
WinGet, ReturnValue, ID, %B% ; get ID | |
return ReturnValue | |
} | |
} | |
return ReturnValue | |
} | |
OpenNewTab() { | |
global Browser, SaveClipboard | |
if (Browser = false) or not WinExist(Browser) { | |
Browser := TryFindBrowserWindow() | |
if not Browser { | |
MsgBox, 0, Ty ciulu, Nie znaleziono okna przeglądarki. Spróbuj otworzyć i ją wybrać. | |
return | |
} | |
} | |
SaveClipboard := Clipboard | |
Clipboard := "" ; //autohotkey.com/board/topic/74182-solved-send-c-isnt-working/?p=471210 | |
Send, ^c | |
ClipWait, 0.3 | |
if ErrorLevel { | |
MsgBox % "Timed out with error level: " . ErrorLevel | |
return | |
} | |
BrowserTitle = | |
WinGetTitle, BrowserTitle, ahk_id %Browser% | |
WinActivate, ahk_id %Browser% | |
Send, ^t | |
} | |
Search(before:="", after:="") { | |
OpenNewTab() | |
Sleep, 300 | |
Send, %before% | |
Send, ^v | |
Sleep, 100 | |
Send, %after% | |
Sleep 10 | |
Send {Enter} | |
if (Clipboard != "") { | |
Clipboard := SaveClipboard | |
} | |
SaveClipboard := "" ; free memory | |
} | |
; jak wcisniesz skrot: ^ - ctrl; + - shift; ! - alt; {Home} albo {Enter} itd. | |
^j:: | |
Search() | |
return | |
!s:: | |
Search("https://sjp.pwn.pl/szukaj/", ".html") | |
return | |
OpenConsole() { | |
Send, ^+c | |
Sleep, 500 | |
Send, ^] | |
Sleep, 50 | |
} | |
!t:: | |
OpenNewTab() | |
Sleep, 100 | |
Send http://www.nkjp.uni.lodz.pl/index_adv.jsp | |
Sleep 100 | |
Send {Enter} | |
Sleep 100 | |
OpenConsole() | |
Sleep 500 | |
Clipboard := "xd=()=>{document.querySelector('#content > form:nth-child(2) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > input:nth-child(1)').value = '" . Trim(Clipboard) . "**';document.querySelector('#content > form:nth-child(2) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(1) > input:nth-child(1)').click()};if(document.readyState === 'complete'){xd()}else{window.onload=xd}" | |
Send ^v | |
Sleep 100 | |
Send {Enter} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment