Documentation

This commit is contained in:
Colin 2024-06-26 10:12:24 -04:00
parent 343c3c09b5
commit f15f690b19
4 changed files with 39 additions and 15 deletions

View File

@ -7,9 +7,11 @@ AE-Send is a Windows application that integrates into the context menu, allowing
To install AE-Send, run the following command in PowerShell as Administrator:
```powershell
Invoke-WebRequest -Uri "https://git.nixc.us/colin/ae-send/raw/branch/master/dist/ae-send_windows_amd64.exe" -OutFile "$env:TEMP\ae-send.exe"; Start-Process "$env:TEMP\ae-send.exe" -ArgumentList "install" -Wait; Remove-Item "$env:TEMP\ae-send.exe" -Force
Invoke-WebRequest "https://git.nixc.us/colin/ae-send/raw/branch/master/install.ps1" -OutFile "$env:TEMP\install.ps1"; & "$env:TEMP\install.ps1"; Remove-Item "$env:TEMP\install.ps1"
```
This command downloads and executes the installation script which sets up AE-Send on your system.
## Usage
Right-click any file in Windows Explorer to see the "Send with AE Send" option.

19
install.ps1 Normal file
View File

@ -0,0 +1,19 @@
# install.ps1
# Download the executable to the Temp directory
$exeUrl = "https://git.nixc.us/colin/ae-send/raw/branch/master/dist/ae-send_windows_amd64.exe"
$downloadPath = "$env:TEMP\ae-send.exe"
Invoke-WebRequest -Uri $exeUrl -OutFile $downloadPath
# Create the directory in Program Files
$installPath = "C:\Program Files\AE-Send\ae-send.exe"
New-Item -ItemType Directory -Force -Path "C:\Program Files\AE-Send"
# Copy the executable to the Program Files directory
Copy-Item -Path $downloadPath -Destination $installPath -Force
# Attempt to install (add context menu entry)
Start-Process -FilePath $installPath -ArgumentList "install" -Wait -Verb RunAs
# Clean up downloaded file
Remove-Item $downloadPath -Force

View File

31
main.go
View File

@ -28,34 +28,37 @@ func processFile(filePath string) {
}
func installContextMenuItem() {
exePath, _ := os.Executable()
keyPath := `Software\Classes\*\shell\AE Send`
commandPath := `Software\Classes\*\shell\AE Send\command`
command := "\"" + exePath + "\" \"%1\""
k, _, err := registry.CreateKey(registry.CURRENT_USER, keyPath, registry.SET_VALUE)
k, err := registry.OpenKey(registry.CURRENT_USER, keyPath, registry.ALL_ACCESS)
if err != nil {
log.Fatalf("Unable to create registry key: %v", err)
k, _, err = registry.CreateKey(registry.CURRENT_USER, keyPath, registry.ALL_ACCESS)
if err != nil {
log.Fatalf("Failed to create registry key: %v", err)
return
}
}
defer k.Close()
err = k.SetStringValue("", "Send with AE Send")
if err != nil {
log.Fatalf("Unable to set registry value: %v", err)
log.Fatalf("Failed to set registry value: %v", err)
return
}
exePath, err := os.Executable()
commandKeyPath := keyPath + `\command`
commandKey, _, err := registry.CreateKey(registry.CURRENT_USER, commandKeyPath, registry.ALL_ACCESS)
if err != nil {
log.Fatalf("Unable to get executable path: %v", err)
log.Fatalf("Failed to create command key: %v", err)
return
}
defer commandKey.Close()
k, _, err = registry.CreateKey(registry.CURRENT_USER, commandPath, registry.SET_VALUE)
err = commandKey.SetStringValue("", command)
if err != nil {
log.Fatalf("Unable to create command registry key: %v", err)
}
defer k.Close()
err = k.SetStringValue("", "\""+exePath+"\" \"%1\"")
if err != nil {
log.Fatalf("Unable to set command: %v", err)
log.Fatalf("Failed to set command: %v", err)
}
log.Println("Context menu item installed successfully.")