-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGoogle.ps1
69 lines (69 loc) · 2.33 KB
/
Google.ps1
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
$FileVersion = "0.1.9"
$host.ui.RawUI.WindowTitle = "Google $FileVersion"
if (!($args)) {
Say ""
Say "Nothing entered to search for, your fired."
Say "Waste of time complete."
Say "Simply type the search line GOOGLE [<something to search>]"
Say "-IMAGE -VIDEO -NEWS Can be added to the string."
Say "As either the very FIRST param or the very LAST"
Say "GOOGLE -IMAGE [<something to search>] or GOOGLE [<something to search>] -IMAGE"
Say ""
return
}
[string]$Search = $args
[string]$Wander = "ALL"
[string]$Key1 = $args[0].trim()
[string]$Key1 = ($Key1).toupper()
[string]$Key2 = $args[-1]
[string]$Key2 = ($Key2)
if ($Key1 -eq "-IMAGE") { [string]$Wander = "IMAGE" }
if ($Key2 -eq "-IMAGE") { [string]$Wander = "IMAGE" }
if ($Key1 -eq "-VIDEO") { [string]$Wander = "VIDEO" }
if ($Key2 -eq "-VIDEO") { [string]$Wander = "VIDEO" }
if ($Key1 -eq "-NEWS") { [string]$Wander = "NEWS" }
if ($Key2 -eq "-NEWS") { [string]$Wander = "NEWS" }
[string]$Search = $Search -replace "-IMAGE", ""
[string]$Search = $Search -replace "-VIDEO", ""
[string]$Search = $Search -replace "-NEWS", ""
Say "Google Searching Category:" $Wander
Say "Google Search String:" $Search
[string]$Search = $Search.trim(" ")
[string]$Search = ($Search -Replace "\s+", " ")
[string]$Search = ($Search -replace ' ', '+')
[string]$Search = $Search.trimstart("+")
[string]$Search = $Search.trimend("+")
if ($Wander -eq "IMAGE") {
[string]$tmp1 = "https://www.google.com/search?q="
[string]$tmp2 = "$Search"
[string]$tmp3 = "&source=lnms&tbm=isch"
[string]$Query = "$tmp1$tmp2$tmp3"
}
if ($Wander -eq "VIDEO") {
[string]$tmp1 = "https://www.google.com/search?q="
[string]$tmp2 = "$Search"
[string]$tmp3 = "&tbm=vid"
[string]$Query = "$tmp1$tmp2$tmp3"
}
if ($Wander -eq "NEWS") {
[string]$tmp1 = "https://www.google.com/search?q="
[string]$tmp2 = "$Search"
[string]$tmp3 = "&tbm=nws"
[string]$Query = "$tmp1$tmp2$tmp3"
}
if ($Wander -eq "ALL") {
[string]$Query = "https://www.google.com/search?q=" + $Search
}
Function DBGoogle {
Say "Args: " $args
Say "Search: " $Search
Say "Wander: " $Wander
Say "Key1: " $Key1
Say "Key2: " $Key2
Say "Wander: " $Wander
Say "Query: " $Query
$pop = Read-Host -Prompt "[Enter To Continue]"
if (!($pop)) { Say "Error" }
}
#DBGoogle
if ($Query) { Start-Process $Query }