-
Notifications
You must be signed in to change notification settings - Fork 2
/
kiwis.menu.ahk
338 lines (279 loc) · 8.91 KB
/
kiwis.menu.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/*
[script info]
version = 0.2.1
description = open a keyword in a website's internal search
author = davebrny
source = https://github.com/davebrny/kiwis
[settings]
recent_total=5
recent_sites=
[ezMenu]
!open_kiwi!
Google
---
Search
Google
Google (Past Month)
DuckDuckGo
StartPage
---
Google Images
Flickr Images
---
Wikipedia
Quora
Reddit (G)
---
Dictionary.com
Urban Dictionary
Thesaurus.com
Wolfram Alpha
Movies
Youtube Trailer
Cinema Showtimes (G)
Can I Stream It?
---
Letterboxd
Letterboxd (reviews)
IMDb
Rotten Tomatoes
Meta Critic
---
Google Movies
Netflix (unofficial)
Amazon Video
Media
Youtube
---
.Music
---
Spotify
Google Music
Bandcamp
SoundCloud
---
.Books
---
Kindle
Google Books
Goodreads
Audible
Code
AutoHotkey Forum
AutoHotkey Docs
StackOverflow
Quora
---
Github
Gist
---
Sublime Package
Shop
Ebay.com
Ebay.com (Sorted)
Amazon UK
Kindle
Amazon US
---
Chrome Store
Play Store
Steam Store
Chocolatey
Social
Twitter
Twitter #
Facebook
Instagram
Google+
---
Reddit
Reddit (G)
Tools
Convert Unit to (G)
Convert Currency (xe.com)
---
Boxoh
Services
Evernote
Dynalist
Todoist
---
Google Maps
Gmail
Google Calender
Google Calender (Add)
Google Drive
Google Translate
>>recent_list>>
[ezMenu_end] ===================================================================
[kiwis]
Amazon UK = https://www.amazon.co.uk/s/&field-keywords=kiwi
Amazon US = https://www.amazon.com/s/&field-keywords=kiwi
Amazon Video = https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Dinstant-video&field-keywords=kiwi
Audible = https://www.audible.co.uk/search?advsearchKeywords=kiwi
AutoHotkey Docs = https://www.google.com/cse?cx=010629462602499112316:ywoq_rufgic&q=kiwi
AutoHotkey Forum = https://autohotkey.com/boards/search.php?keywords=kiwi
Bandcamp = https://bandcamp.com/search?q=kiwi
Boxoh = http://www.boxoh.com/?t=kiwi
Can I Stream It? = http://www.canistream.it/search/movie/kiwi
Chocolatey = https://chocolatey.org/packages?q=kiwi
Chrome Store = https://chrome.google.com/webstore/search/kiwi?hl=en
Cinema Showtimes (G) = https://www.google.ie/search?&q=kiwi+showtimes
Convert Currency (xe.com) = http://www.xe.com/currencyconverter/convert/?Amount=kiwi&From=EUR&To=GBP
Convert Unit to (G) = https://www.google.ie/search?hl=en&dcr=0&source=hp&q=unit+converter+kiwi+in
Dictionary.com = http://www.dictionary.com/browse/kiwi
DuckDuckGo = https://duckduckgo.com/?q=kiwi
Dynalist = https://dynalist.io/#q=kiwi
Ebay.com (Sorted) = https://www.ebay.com/sch/i.html?_sop=15&LH_BIN=1&_nkw=kiwi&rt=nc&LH_PayPal=1&_udlo&_udhi
Ebay.com = https://www.ebay.com/sch/i.html?&_nkw=kiwi
Evernote = https://www.evernote.com/Home.action#ses=1&sh=5&sds=5&x=kiwi&
Facebook = https://www.facebook.com/search/top/?q=kiwi
Flickr Images = http://www.flickr.com/search/?q=kiwi&w=all
Gist = https://gist.github.com/search?&q=kiwi
Github = https://github.com/search?&q=kiwi&type=
Gmail = https://mail.google.com/mail/u/0/#search/kiwi
Goodreads = https://www.goodreads.com/search?&query=kiwi
Google (Past Month) = http://www.google.com/search?q=kiwi&tbs=qdr:m
Google = http://www.google.com/search?q=kiwi
Google Books = https://play.google.com/store/search?q=kiwi&c=books
Google Calender (Add) = https://calendar.google.com/calendar/render?action=TEMPLATE&text=kiwi
Google Calender = https://calendar.google.com/calendar/render#main_7|search-1+24403+24403+24403-n+kiwi++++++++2+31
Google Drive = https://drive.google.com/drive/u/0/search?q=kiwi
Google Images = http://www.google.com/images?q=kiwi
Google Maps = http://maps.google.com/maps?q=kiwi
Google Movies = https://play.google.com/store/search?q=kiwi&c=movies
Google Music = https://play.google.com/music/listen?u=0#/sr/kiwi
Google Translate = https://translate.google.com/#auto/en/kiwi
Google+ = https://plus.google.com/u/0/s/kiwi
IMDb = http://www.imdb.com/find?ref_=nv_sr_fn&q=kiwi&s=all
Instagram = https://www.instagram.com/explore/tags/kiwi
Kindle = https://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Ddigital-text&field-keywords=kiwi
Letterboxd (reviews) =https://letterboxd.com/search/reviews/kiwi
Letterboxd = https://letterboxd.com/search/kiwi
Meta Critic = http://www.metacritic.com/search/all/kiwi/results
Netflix (unofficial) = http://unogs.com/?q=kiwi
Play Store = https://play.google.com/store/search?q=kiwi
Quora = https://www.quora.com/search?q=kiwi
Reddit (G) = http://www.google.com/search?q=site:reddit.com+kiwi
Reddit = https://www.reddit.com/search?q=kiwi&sort=relevance&t=all
Rotten Tomatoes = http://www.rottentomatoes.com/search/?search=kiwi
SoundCloud = https://soundcloud.com/search?q=kiwi
Spotify = https://open.spotify.com/search/results/kiwi
StackOverflow = https://stackoverflow.com/search?q=kiwi
StartPage = https://www.startpage.com/do/search?q=kiwi
Steam Store = http://store.steampowered.com/search/?term=kiwi
Sublime Package = https://packagecontrol.io/search/kiwi
Thesaurus.com = http://thesaurus.com/browse/kiwi
Todoist = https://todoist.com/app#agenda%2Fkiwi
Twitter # = https://twitter.com/search?q=%23kiwi&src=typd
Twitter = https://twitter.com/search?q=kiwi&src=typd
Urban Dictionary = http://www.urbandictionary.com/define.php?term=kiwi
Wikipedia = http://en.wikipedia.org/wiki/Special:Search?search=kiwi
Wolfram Alpha = http://www.wolframalpha.com/input/?i=kiwi
YouTube = http://www.youtube.com/results?search_query=kiwi
YouTube Trailer = http://www.youtube.com/results?search_query=kiwi+trailer
*/
#noEnv
#singleInstance, force
sendMode input
setWorkingDir, % a_scriptDir
onExit, save_recent
menu, tray, tip, % "kiwis.menu"
menu, tray, icon, kiwis.menu.ico, , , useErrorLevel
menu, tray, add
menu, tray, add, Start with Windows, start_with_windows
sww_shortcut := a_startup "\" subStr(a_scriptName, 1, strLen(a_scriptName) - 4) ".lnk"
menu, tray, % fileExist(sww_shortcut) ? "check" : "unCheck", Start with Windows
menu, tray, add, Clear recent sites, clear_recents
iniRead, recent_sites, % a_lineFile, settings, recent_sites
iniRead, recent_total, % a_lineFile, settings, recent_total
recent := []
loop, parse, % trim(recent_sites, "|"), |, % a_space
recent.push(a_loopField)
menu_text := ezMenu_get(a_lineFile)
hotkey, ^!k, show_kiwis ; altGr + k
return ; end of auto-execute---------------------------------------------------
show_kiwis:
clipboard_save := clipboardAll
clipboard := ""
send ^{c}
clipWait, 0.3
keyword := clipboard
clipboard := clipboard_save
if keyword is space ; if empty or whitespace
selected := "LAUNCH MODE"
else selected := trim(keyword)
if (strLen(selected) > t := 32) ; if keyword is longer than t then truncate
selected := subStr(selected, 1, t/2) " . . . . " subStr(selected, -t/2)
menu, kiwis, add, % selected, open_kiwi
menu, kiwis, default, % selected
menu, kiwis, icon, % selected, kiwis.menu.ico
menu, kiwis, disable, % selected
menu, kiwis, add
ezMenu("kiwis", menu_text, "append_recent")
return
open_kiwi:
iniRead, url, % a_lineFile, kiwis, % a_thisMenuItem
if (url = "ERROR")
msgBox, ERROR: "%a_thisMenuItem%" not found in ini section
else
{
if (keyword = "LAUNCH MODE") ; then change to root url
splitPath, url, , , , , url
run, % strReplace(url, "kiwi", keyword)
}
add_recent(1, a_thisMenuItem)
return
add_recent(at, kiwi) {
global recent, recent_total
position := hasVal(recent, kiwi)
if (position) ; if already in array
recent.removeAt(position)
recent.insertAt(at, kiwi)
if (recent.maxIndex() > recent_total)
recent.pop()
}
hasVal(haystack, needle) { ; by jNizM
if !(isObject(haystack)) || (haystack.Length() = 0)
return 0
for index, value in haystack
if (value = needle)
return index
return 0
}
append_recent() {
global recent, menu_text
if recent.maxIndex()
{
recent_list := "`n---`n.Recent kiwis:`n---`n"
loop, % recent.maxIndex()
recent_list .= recent[a_index] "`n"
}
else recent_list := ""
return strReplace(menu_text, ">>recent_list>>", recent_list)
}
save_recent: ; (onExit)
iniRead, those_kiwis, % a_lineFile, settings, recent_sites
loop, % recent.maxIndex()
these_kiwis .= recent[a_index] "|"
if (these_kiwis != those_kiwis)
iniWrite, % these_kiwis, % a_lineFile, settings, recent_sites
exitApp
start_with_windows: ; (tray menu)
if fileExist(sww_shortcut)
{
fileDelete, % sww_shortcut
menu, tray, unCheck, Start with Windows
trayTip, , Startup Shortcut removed, 5
}
else
{
fileCreateShortcut, % a_scriptFullPath, % sww_shortcut
menu, tray, check, Start with Windows
trayTip, , Startup Shortcut created, 5
}
return
clear_recents: ; (tray menu)
recent := []
iniWrite, % "", % a_lineFile, settings, recent_sites
return