Created
September 28, 2021 18:40
-
-
Save JakubKoralewski/215ad565b779cc45bec6b59ee550cab3 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 | |
} | |
Search(before:="", after:="") { | |
global Browser | |
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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment