Update main.ps1

This commit is contained in:
egieb
2024-06-25 11:36:52 +00:00
committed by GitHub
parent b43340b66f
commit ca05fa1eb7

View File

@@ -23,12 +23,12 @@ $fps.AutoSize = $true
$fps.Font = 'Microsoft Sans Serif,10'
$fps.Location = New-Object System.Drawing.Point(60, 40)
$frBox = New-Object System.Windows.Forms.TextBox
$frBox.Location = New-Object System.Drawing.Point(18, 40)
$frBox.BackColor = "#eeeeee"
$frBox.Width = 40
$frBox.Text = "25"
$frBox.Multiline = $false
$frBox = New-Object System.Windows.Forms.TextBox
$frBox.Location = New-Object System.Drawing.Point(18, 40)
$frBox.BackColor = "#eeeeee"
$frBox.Width = 40
$frBox.Text = "25"
$frBox.Multiline = $false
$frBox.Font = 'Microsoft Sans Serif,8,style=Bold'
$Text2 = New-Object Windows.Forms.Label
@@ -42,12 +42,12 @@ $sec.AutoSize = $true
$sec.Font = 'Microsoft Sans Serif,10'
$sec.Location = New-Object System.Drawing.Point(165, 40)
$tBox = New-Object System.Windows.Forms.TextBox
$tBox.Location = New-Object System.Drawing.Point(123, 40)
$tBox.BackColor = "#eeeeee"
$tBox.Width = 40
$tBox.Text = "30"
$tBox.Multiline = $false
$tBox = New-Object System.Windows.Forms.TextBox
$tBox.Location = New-Object System.Drawing.Point(123, 40)
$tBox.BackColor = "#eeeeee"
$tBox.Width = 40
$tBox.Text = "30"
$tBox.Multiline = $false
$tBox.Font = 'Microsoft Sans Serif,8,style=Bold'
$Text3 = New-Object Windows.Forms.Label
@@ -61,12 +61,12 @@ $ofx.AutoSize = $true
$ofx.Font = 'Microsoft Sans Serif,10'
$ofx.Location = New-Object System.Drawing.Point(60, 90)
$oxBox = New-Object System.Windows.Forms.TextBox
$oxBox.Location = New-Object System.Drawing.Point(18, 90)
$oxBox.BackColor = "#eeeeee"
$oxBox.Width = 40
$oxBox.Text = "0"
$oxBox.Multiline = $false
$oxBox = New-Object System.Windows.Forms.TextBox
$oxBox.Location = New-Object System.Drawing.Point(18, 90)
$oxBox.BackColor = "#eeeeee"
$oxBox.Width = 40
$oxBox.Text = "0"
$oxBox.Multiline = $false
$oxBox.Font = 'Microsoft Sans Serif,8,style=Bold'
$Text4 = New-Object Windows.Forms.Label
@@ -80,12 +80,12 @@ $ofy.AutoSize = $true
$ofy.Font = 'Microsoft Sans Serif,10'
$ofy.Location = New-Object System.Drawing.Point(165, 90)
$oyBox = New-Object System.Windows.Forms.TextBox
$oyBox.Location = New-Object System.Drawing.Point(123, 90)
$oyBox.BackColor = "#eeeeee"
$oyBox.Width = 40
$oyBox.Text = "0"
$oyBox.Multiline = $false
$oyBox = New-Object System.Windows.Forms.TextBox
$oyBox.Location = New-Object System.Drawing.Point(123, 90)
$oyBox.BackColor = "#eeeeee"
$oyBox.Width = 40
$oyBox.Text = "0"
$oyBox.Multiline = $false
$oyBox.Font = 'Microsoft Sans Serif,8,style=Bold'
$Text5 = New-Object Windows.Forms.Label
@@ -94,12 +94,12 @@ $Text5.Font = 'Microsoft Sans Serif,10'
$Text5.AutoSize = $true
$Text5.Location = New-Object System.Drawing.Point(15, 120)
$vsBox = New-Object System.Windows.Forms.TextBox
$vsBox.Location = New-Object System.Drawing.Point(18, 140)
$vsBox.BackColor = "#eeeeee"
$vsBox.Width = 140
$vsBox.Text = "1920x1080"
$vsBox.Multiline = $false
$vsBox = New-Object System.Windows.Forms.TextBox
$vsBox.Location = New-Object System.Drawing.Point(18, 140)
$vsBox.BackColor = "#eeeeee"
$vsBox.Width = 140
$vsBox.Text = "1920x1080"
$vsBox.Multiline = $false
$vsBox.Font = 'Microsoft Sans Serif,8,style=Bold'
$Download = New-Object Windows.Forms.Button
@@ -129,14 +129,26 @@ $startrecord.ForeColor = [System.Drawing.Color]::Black
$startrecord.Location = New-Object System.Drawing.Point(210, 130)
$startrecord.Font = 'Microsoft Sans Serif,10,style=Bold'
$form.Controls.AddRange(@($Text,$fps,$frBox,$Text2,$sec,$tbox,$Text3,$ofx,$oxBox,$Text4,$ofy,$oyBox,$Text5,$vsBox,$Download,$Check,$startrecord))
$Download.Add_Click{
$Path = "$env:Temp\ffmpeg.exe"
If (!(Test-Path $Path)){
$url = "https://cdn.discordapp.com/attachments/803285521908236328/1089995848223555764/ffmpeg.exe"
iwr -Uri $url -OutFile $Path
$form.Controls.AddRange(@($Text,$fps,$frBox,$Text2,$sec,$tbox,$Text3,$ofx,$oxBox,$Text4,$ofy,$oyBox,$Text5,$vsBox,$Download,$Check,$startrecord))
$Download.Add_Click{
$Path = "$env:Temp\ffmpeg.exe"
If (!(Test-Path $Path)){
$tempDir = "$env:temp"
$apiUrl = "https://api.github.com/repos/GyanD/codexffmpeg/releases/latest"
$response = Invoke-WebRequest -Uri $apiUrl -Headers @{ "User-Agent" = "PowerShell" } -UseBasicParsing
$release = $response.Content | ConvertFrom-Json
$asset = $release.assets | Where-Object { $_.name -like "*essentials_build.zip" }
$zipUrl = $asset.browser_download_url
$zipFilePath = Join-Path $tempDir $asset.name
$extractedDir = Join-Path $tempDir ($asset.name -replace '.zip$', '')
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFilePath
Expand-Archive -Path $zipFilePath -DestinationPath $tempDir -Force
Move-Item -Path (Join-Path $extractedDir 'bin\ffmpeg.exe') -Destination $tempDir -Force
Remove-Item -Path $zipFilePath -Force
Remove-Item -Path $extractedDir -Recurse -Force
Write-Output "FFmpeg has been downloaded and extracted to $tempDir"
}
}
@@ -159,4 +171,4 @@ if ($vs.Length -eq 0){$vs = "1920x1080"}
.$env:Temp\ffmpeg.exe -f gdigrab -framerate $fr -t $t -offset_x $ox -offset_y $oy -video_size $vs -show_region 1 -i desktop $mkvPath
}
$form.ShowDialog()
$form.ShowDialog()