-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathinstall-ahi.ps1
More file actions
68 lines (51 loc) · 1.87 KB
/
install-ahi.ps1
File metadata and controls
68 lines (51 loc) · 1.87 KB
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
#Requires -RunAsAdministrator
#Requires -Version 5.0
function GetLatestReleaseLink($repoURL) {
return (Invoke-WebRequest $repoURL | ConvertFrom-Json).assets[0].browser_download_url
}
function Install-AHK {
# Download it
$installerURL = "https://www.autohotkey.com/download/ahk-install.exe"
Invoke-WebRequest($installerURL) -OutFile ahk-install.exe
# Install it
.\ahk-install.exe /S
}
function Install-Interception {
# Download it
$repoURL = "http://api.github.com/repos/oblitum/Interception/releases/latest"
Invoke-WebRequest(GetLatestReleaseLink($repoURL)) -OutFile Interception.zip
# Unzip it
Expand-Archive Interception.zip -DestinationPath . -Force
# Install it
& '.\Interception\command line installer\install-interception.exe' /install
}
function Install-AHI {
# Download it
$repoURL = "http://api.github.com/repos/evilC/AutoHotInterception/releases/latest"
Invoke-WebRequest(GetLatestReleaseLink($repoURL)) -OutFile AutoHotInterception.zip
# Unzip it
Expand-Archive AutoHotInterception.zip -DestinationPath AutoHotInterception -Force
# Copy the Interception libs to AHI libs
robocopy Interception\library AutoHotInterception\Lib *.* /s /is /it
# Unblock the DLLs
AutoHotInterception\Lib\Unblocker.ps1
# Copy libs to 'My Documents'
$myDocsLibDir = Join-Path -Path ([Environment]::GetFolderPath("MyDocuments")) -ChildPath "AutoHotkey\lib"
robocopy AutoHotInterception\Lib $myDocsLibDir *.* /s /is /it
}
function Clean-Up() {
Foreach ($item in "ahk-install.exe", "Interception.zip", "Interception", "AutoHotInterception.zip") {
Remove-Item -Recurse -Force $item
}
}
function main {
# Change to script directory
Set-Location $PSScriptRoot
Install-AHK
Install-Interception
Install-AHI
Clean-Up
# Prompt for reboot
Restart-Computer -Confirm
}
main