-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintro.ps1
79 lines (65 loc) · 2.5 KB
/
intro.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
70
71
72
73
74
75
76
77
78
79
# Path to the video you want to play
$videoPath = "[INSERT VIDEO PATH]"
$vlcPath = "C:\Program Files\VideoLAN\VLC\vlc.exe"
# Define the P/Invoke method to call user32.dll functions
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class User32 {
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
}
"@
# _______ _________ _____ ______ _
# / _____ \ |____ ____| / ___ \ | ____ \ | |
#/ / \_\ | | / / \ \ | | \ \ | |
#| | | | / / \ \ | | | | | |
#\ \______ | | | | | | | |___/ / | |
# \______ \ | | | | | | | ____/ | |
# \ \ | | | | | | | | | |
# _ | | | | \ \ / / | | |_|
#\ \_____/ / | | \ \___/ / | | _
# \_______/ |_| \_____/ |_| |_|
# Stop!
# If someone instructed you to edit this code with another, it is not advisable to do so.
# Please do not edit the code unless you are certain of what you are doing.
# If you need something in the code to be modified, please inform the creators.
# Get the handle of the current PowerShell window
$hwnd = [User32]::GetForegroundWindow()
# Minimize the window
[User32]::ShowWindow($hwnd, 6)
# Variable to control full-screen playback
$fullscreen = $true
# VLC arguments
if ($fullscreen) {
$vlcArgs = "--fullscreen --play-and-exit --no-osd `"$videoPath`""
} else {
$vlcArgs = "--play-and-exit --no-osd `"$videoPath`""
}
# Function to check if Roblox is running
function Is-RobloxRunning {
$robloxProcesses = @("RobloxPlayerBeta", "RobloxStudioBeta")
foreach ($process in $robloxProcesses) {
if (Get-Process -Name $process -ErrorAction SilentlyContinue) {
return $true
}
}
return $false
}
# Wait for Roblox to start
while (-not (Is-RobloxRunning)) {
Start-Sleep -Seconds 1
}
# Wait a bit more to allow the window to appear
Start-Sleep -Seconds 5
# Start VLC and play the video
$vlcProcess = Start-Process -FilePath $vlcPath -ArgumentList $vlcArgs -PassThru
# Wait for VLC to exit on its own (due to --play-and-exit)
$vlcProcess.WaitForExit()
# If for some reason VLC is still running, force it to close
if (Get-Process -Id $vlcProcess.Id -ErrorAction SilentlyContinue) {
Stop-Process -Id $vlcProcess.Id -Force
}