-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeaning.ado
78 lines (55 loc) · 2.75 KB
/
meaning.ado
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
*! version 1.0.1 Mehrab Ali 04mar2019
cap program drop meaning
program meaning
version 11
* ----------------------------------------------------------------------------
* 1. Define syntax
* ----------------------------------------------------------------------------
#d ;
syntax
[anything],
[PROnounce]
;
#d cr
local searchitem = regexr("`anything'", " ","+")
! powershell.exe -windowstyle hidden Set-ExecutionPolicy Unrestricted -Scope CurrentUser
tempname handle
file open `handle' using "C:\Windows\Temp\psfile.ps1", text write replace
file write `handle' _newline "$" `"IE= new-object -com "InternetExplorer.Application""'
file write `handle' _newline "$" `"IE.navigate2("https://www.google.com/search?q=`searchitem'+meaning&num=2")"'
file write `handle' _newline ""
file write `handle' _newline "while (" "$" `"IE.busy) {"'
file write `handle' _newline " sleep -milliseconds 100"
file write `handle' _newline " }"
file write `handle' _newline ""
file write `handle' _newline "$" `"List = New-Object Collections.Generic.List[String]"'
file write `handle' _newline "$" "IE.visible=""$""false"
file write `handle' _newline "$" "IE.visible=""$""false"
file write `handle' _newline " Select -First 1 |"
file write `handle' _newline " % { " "$" "_.submit() }"
file write `handle' _newline ""
file write `handle' _newline "while (" "$" `"IE.busy) {"'
file write `handle' _newline " sleep -milliseconds 100"
file write `handle' _newline " }"
file write `handle' _newline ""
file write `handle' _newline "foreach(" "$" "sw in " "$" `"IE.document.getElementById("search").getElementsByTagName("span")) {"'
file write `handle' _newline "$" "List += " "$" "sw.innerText;"
file write `handle' _newline " }"
file write `handle' _newline "foreach(" "$" "sw in " "$" `"IE.document.getElementById("search").getElementsByTagName("iUh30")) {"'
file write `handle' _newline "$" "List2 += " "$" "sw.innerText;"
file write `handle' _newline " }"
file write `handle' _newline ""
file write `handle' _newline "$" "List2" " + $" `"List | out-file "C:\Windows\Temp\search-out.txt""'
file close `handle'
! powershell -windowstyle hidden "& ""C:\Windows\Temp\\psfile.ps1"""
! start notepad.exe "C:\Windows\Temp\search-out.txt"
if ("`pronounce'" != "") {
tempname audio
file open `audio' using "C:\Windows\Temp\audio.ps1", text write replace
file write `audio' _newline "Add-Type -AssemblyName System.speech"
file write `audio' _newline "$" `"speak = New-Object System.Speech.Synthesis.SpeechSynthesizer"'
file write `audio' _newline "$" `"speak.Speak("`searchitem'")"'
file close `audio'
! powershell -windowstyle hidden "& ""C:\Windows\Temp\\audio.ps1"""
}
end