Last active
August 29, 2015 14:26
-
-
Save budRich/07b7903cb7d73bdabebb 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
#SingleInstance, force | |
/* | |
## UrlList by budRich 2015 | |
## ----------------------- | |
## This script adds a hotstring (_url) that trigger | |
## a menu with the 10 most recent links from irc. | |
## | |
## All you need is irssi and the script urlgrab.pl ;) | |
## Change fUrlLog to your liking. | |
*/ | |
fUrlLog := "c:\cygwin\home\bud\.urllog" | |
sCancel := "Eller inte..." | |
nMaxItems := 25 | |
:*:_url:: | |
aw := WinActive("A") | |
Menu, UrlMenu, Add, %sCancel%, MenuHandler | |
Menu, UrlMenu, DeleteAll | |
FileRead, f1, %fUrlLog% | |
StringReplace,OutputVar,f1,`n,`n,useerrorlevel | |
Lines:=ErrorLevel | |
Loop,% (Lines<nMaxItems?Lines:nMaxItems) | |
{ | |
FileReadLine, sL, %fUrlLog%, %Lines% | |
; Lineformat: Timestamp user channel url | |
StringSplit, sLi, sl, %A_Space%, %A_Space%%A_Tab% | |
Menu, UrlMenu, Add,% sLi2 ": " sLi4, MenuHandler | |
Lines-- | |
} | |
Menu, UrlMenu, Add,%sCancel%, MenuHandler | |
Menu, UrlMenu, Show | |
MenuHandler: | |
if (A_ThisMenuItem=sCancel) | |
{ | |
Menu, UrlMenu, DeleteAll | |
return | |
} | |
StringSplit, uGo, A_ThisMenuItem, %A_Space%, %A_Space%%A_Tab% | |
Run, %uGo2% | |
; WinActivate, ahk_class MozillaWindowClass | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment