From a7cd44016f2bfc612aed3994b504b800fd159c5c Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 14 Apr 2023 08:47:18 +0200 Subject: [PATCH] =?UTF-8?q?OO=20verbessert=20und=20ahk=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.ps1 | 32 +++++++++++++++++++++++------ configs/autohotkey/NewTxt.ahk | 34 +++++++++++++++++++++++++++++++ configs/ooshutup10/ooshutup10.cfg | 2 +- functions.ps1 | 11 +++++++--- 4 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 configs/autohotkey/NewTxt.ahk diff --git a/config.ps1 b/config.ps1 index b61c152..69252cf 100644 --- a/config.ps1 +++ b/config.ps1 @@ -10,7 +10,7 @@ $toRemove = @('Clipchamp.Clipchamp_yxz26nhyzhsrt', 'Microsoft.549981C3F5F10_8wek $toInstall = @('7zip.7zip', 'VideoLAN.VLC', 'SumatraPDF.SumatraPDF', 'Microsoft.VisualStudioCode', 'Bitwarden.Bitwarden', 'Mozilla.Firefox', 'IrfanSkiljan.IrfanView', 'Microsoft.PowerToys', 'Joplin.Joplin', 'WireGuard.WireGuard', 'Devolutions.RemoteDesktopManager', 'TeamViewer.TeamViewer', 'NickeManarin.ScreenToGif', 'JanDeDobbeleer.OhMyPosh', 'WiresharkFoundation.Wireshark', 'Famatech.AdvancedIPScanner', - 'yt-dlp.yt-dlp'.'Audacity.Audacity', 'ffmpeg', 'mp4-merge') + 'yt-dlp.yt-dlp'.'Audacity.Audacity', 'ffmpeg', 'mp4-merge', 'AutoHotkey.AutoHotkey') $toInstallOpt = @('Element.Element', 'Discord.Discord', 'Corsair.iCUE.4', 'Valve.Steam', 'GOG.Galaxy', 'TeXstudio.TeXstudio', 'MiKTeX.MiKTeX', 'Citrix.Workspace', 'Nvidia.GeForceExperience', 'Mojang.MinecraftLauncher', 'Elgato.StreamDeck', 'REALiX.HWiNFO', '9P4CLT2RJ1RS', 'Microsoft.SQLServerManagementStudio', 'Soundboard', 'VMware.WorkstationPro', 'OBSProject.OBSStudio', 'Microsoft.Teams') @@ -102,12 +102,22 @@ function InstallSoftware { Write-Host "Installiere mp4-merge..." -ForegroundColor Blue try { curl.exe -L https://github.com/gyroflow/mp4-merge/releases/download/v0.1.4/mp4_merge-windows64.exe -o C:\Windows\mp4merge.exe - Write-Host "ffmpeg wurde erfolgreich installiert." -ForegroundColor Green + Write-Host "mp4-merge wurde erfolgreich installiert." -ForegroundColor Green } catch { Write-Host "Es ist ein Fehler bei der Installation von mp4-merge auftreten. Bitte das Log durchsuchen." -ForegroundColor Red } - } + } + elseif ($utility -eq 'AutoHotkey.AutoHotkey'){ + Write-Host "Installiere AutoHotkey..." -ForegroundColor Blue + try { + winget install -e --id AutoHotkey.AutoHotkey -l "C:\Program Files\AutoHotKey" + Write-Host "AutoHotkey wurde erfolgreich installiert." -ForegroundColor Green + } + catch { + Write-Host "Es ist ein Fehler bei der Installation von Autohotkey auftreten. Bitte das Log durchsuchen." -ForegroundColor Red + } + } } } Catch { @@ -234,7 +244,16 @@ function InstallSoftware { Write-Host "Probleme beim verlinken der Powershell config ~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 ." -ForegroundColor Red } } - } + } + # Autohotkey in Startup + Write-Host "Verlinke AutoHokey Scripts ..." -ForegroundColor Blue + $sourceDir = "~\.winconfig\configs\autohotkey" + $targetDir = "~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" + Get-ChildItem -Path $sourceDir | ForEach-Object { + $linkPath = Join-Path $targetDir $_.Name + New-Item -ItemType SymbolicLink -Path $linkPath -Target $_.FullName -ErrorAction SilentlyContinue | Out-Null + } + Write-Host "AutoHotkey Scripts erfolgreich installiert." -ForegroundColor Green # Powershell Modul für Updates if (Get-Module -ListAvailable -Name PSWindowsUpdate) { Write-Hoste "Windows Update Powershell Modul ist bereits installiert." -ForegroundColor Blue @@ -253,11 +272,12 @@ function InstallSoftware { Read-Host "Bitte das Terminal / Powershell neu starten damit die Aenderungen uebernommen werden." # Windows Explorer Einrichten New-Item -Path "HKCU:\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" -Value "" -Force - Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -value '00000001' - Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'HideFileExt' -value '00000000' + Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'Hidden' -value '00000001' # Versteckte Files anzeigen + Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'HideFileExt' -value '00000000' # Fileextensions anzeigen lassen Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CabinetState' -Name 'FullPath' -value '00000001' Remove-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarSi' New-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarSi' -value '0000001' -PropertyType DWORD + Set-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer' -Name 'EnableAutoTray' -value '00000001' # Alle Tray Icons immer anzeigen Write-Host "Starte Explorer neu um änderungen zu übernehmen" Get-Process explorer | Stop-Process diff --git a/configs/autohotkey/NewTxt.ahk b/configs/autohotkey/NewTxt.ahk new file mode 100644 index 0000000..235f2f1 --- /dev/null +++ b/configs/autohotkey/NewTxt.ahk @@ -0,0 +1,34 @@ +#Requires AutoHotkey v2.0 +;Mit Strg, Shift + M wird ein leeres Textfile erzeugt. +#HotIf ("ahk_class CabinetWClass") +^+m:: +{ + WinID := WinGetID("ahk_class CabinetWClass") + CurrentPath := GetPath(WinID) + CreateFile(CurrentPath) + return +} +#HotIf + +;Ermittelt den aktuellen Pfad +GetPath(_hwnd) +{ + for w in ComObject("Shell.Application").Windows + if (w.hwnd = _hwnd) + { + path := StrReplace(w.LocationURL, "file:///") + return StrReplace(path, "%20", " ") + } +} + +;Schreibt die Datei +CreateFile(path) +{ + file := path "/NewFile.txt" + if FileExist(file) + { + MsgBox "NewFile.txt bereits vorhanden" + return + } + FileAppend "", file +} \ No newline at end of file diff --git a/configs/ooshutup10/ooshutup10.cfg b/configs/ooshutup10/ooshutup10.cfg index 6b68dfe..7232200 100644 --- a/configs/ooshutup10/ooshutup10.cfg +++ b/configs/ooshutup10/ooshutup10.cfg @@ -41,7 +41,7 @@ P016 - A001 + A002 + A003 + -A004 + +A004 - A006 - A005 + P007 + diff --git a/functions.ps1 b/functions.ps1 index a4d02ef..7b517fe 100644 --- a/functions.ps1 +++ b/functions.ps1 @@ -11,6 +11,14 @@ function allupdates { Set-Location $HOME/.winconfig ; ./OOSU10.exe configs/ooshutup10/ooshutup10.cfg /quiet Write-Host "Ziehe aktuelle winconfig von git..." -ForegroundColor Blue Set-Location $HOME/.winconfig ; git pull + Write-Host "Aktuallisiere AutoHokey Scripts ..." -ForegroundColor Blue + $sourceDir = "$HOME\.winconfig\configs\autohotkey" + $targetDir = "$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" + Get-ChildItem -Path $targetDir -Filter *.ahk -Recurse | Remove-Item -Force -ErrorAction SilentlyContinue + Get-ChildItem -Path $sourceDir | ForEach-Object { + $linkPath = Join-Path $targetDir $_.Name + New-Item -ItemType SymbolicLink -Path $linkPath -Target $_.FullName -ErrorAction SilentlyContinue | Out-Null + } Write-Host "Update aller Powershell Module..." -ForegroundColor Blue Write-Host -ForegroundColor Blue 'Get all PowerShell modules' function Remove-OldPowerShellModules { @@ -146,7 +154,4 @@ function allupdates { } } } - # ooshutup10 ausführen. Manchmal werden settings nach Windos updates zurückgesetzt - Write-Host "Spiele aktuelle OOSHUTUP10 config ein... " -ForegroundColor Blue - Set-Location $HOME/.winconfig ; ./OOSU10.exe configs/ooshutup10/ooshutup10.cfg /quiet } \ No newline at end of file