Skip to content

Commit

Permalink
To Version: 0.1.25
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpi committed Jul 6, 2022
1 parent ef836f7 commit 91295cc
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Pierre Smit
#
# Generated on: 2022-07-06 04:13:33Z
# Generated on: 2022-07-06 04:32:09Z
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'PSLauncher.psm1'

# Version number of this module.
ModuleVersion = '0.1.24'
ModuleVersion = '0.1.25'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
155 changes: 77 additions & 78 deletions Output/0.1.24/PSLauncher.psm1 → Output/0.1.25/PSLauncher.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
######## Function 1 of 4 ##################
# Function: Add-PSLauncherEntry
# Module: PSLauncher
# ModuleVersion: 0.1.24
# ModuleVersion: 0.1.25
# Author: Pierre Smit
# Company: HTPCZA Tech
# CreatedOn: 2022/04/01 21:34:46
# ModifiedOn: 2022/07/06 04:12:32
# ModifiedOn: 2022/07/06 04:31:42
# Synopsis: Add a button or panel to the config.
#############################################

Expand Down Expand Up @@ -89,79 +89,76 @@ Function Add-PSLauncherEntry {
Write-Output ' '
[int]$indexnum = Read-Host 'Panel Number '

do {
$name = Read-Host 'New Button Name'

Write-Color 'Choose the mode:' -Color DarkRed -StartTab 1 -LinesBefore 2
Write-Color '0) ', 'PowerShell Script file' -Color Yellow, Green
Write-Color '1) ', 'PowerShell Command' -Color Yellow, Green
Write-Color '2) ', 'Other Executable' -Color Yellow, Green
$modechoose = Read-Host 'Answer'

switch ($modechoose) {
'0' {
$mode = 'PSFile'
$command = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
$arguments = Read-Host 'Path to .ps1 file'
}
'1' {
$mode = 'PSCommand'
$command = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
$arguments = Read-Host 'PowerShell command or scriptblock'

}
'2' {
$mode = 'Other'
$command = Read-Host 'Path to executable'
$arguments = Read-Host 'Arguments for the executable'
}
}
$cmd = [PSCustomObject]@{
mode = $mode
command = $command
arguments = $arguments
}
$name = Read-Host 'New Button Name'

Write-Color 'Choose the window size:' -Color DarkRed -StartTab 1 -LinesBefore 2
Write-Color '0) ', 'Hidden' -Color Yellow, Green
Write-Color '1) ', 'Normal' -Color Yellow, Green
Write-Color '2) ', 'Minimized' -Color Yellow, Green
Write-Color '3) ', 'Maximized' -Color Yellow, Green
$modechoose = Read-Host 'Answer'

switch ($modechoose) {
'0' {$Window = 'Hidden'}
'1' {$Window = 'Normal'}
'2' {$Window = 'Minimized'}
'3' {$Window = 'Maximized'}
Write-Color 'Choose the mode:' -Color DarkRed -StartTab 1 -LinesBefore 2
Write-Color '0) ', 'PowerShell Script file' -Color Yellow, Green
Write-Color '1) ', 'PowerShell Command' -Color Yellow, Green
Write-Color '2) ', 'Other Executable' -Color Yellow, Green
$modechoose = Read-Host 'Answer'

switch ($modechoose) {
'0' {
$mode = 'PSFile'
$command = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
$arguments = Read-Host 'Path to .ps1 file'
}
'1' {
$mode = 'PSCommand'
$command = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
$arguments = Read-Host 'PowerShell command or scriptblock'

Write-Color 'Run As Admin:' -Color DarkRed -StartTab 1 -LinesBefore 2
Write-Color '0) ', 'Yes' -Color Yellow, Green
Write-Color '1) ', 'No' -Color Yellow, Green
$modechoose = Read-Host 'Answer'
switch ($modechoose) {
'0' {$RunAs = 'Yes'}
'1' {$RunAs = 'No'}
}
'2' {
$mode = 'Other'
$command = Read-Host 'Path to executable'
$arguments = Read-Host 'Arguments for the executable'
}
}
$cmd = [PSCustomObject]@{
mode = $mode
command = $command
arguments = $arguments
}

if ([string]::IsNullOrEmpty($jsondata.Buttons[$indexnum].Buttons.id)) {[int]$ID = 0}
else { [int]$ID = (($jsondata.Buttons[$indexnum].Buttons.id | Sort-Object -Descending | Select-Object -First 1) + 1)}
Write-Color 'Choose the window size:' -Color DarkRed -StartTab 1 -LinesBefore 2
Write-Color '0) ', 'Hidden' -Color Yellow, Green
Write-Color '1) ', 'Normal' -Color Yellow, Green
Write-Color '2) ', 'Minimized' -Color Yellow, Green
Write-Color '3) ', 'Maximized' -Color Yellow, Green
$modechoose = Read-Host 'Answer'

switch ($modechoose) {
'0' {$Window = 'Hidden'}
'1' {$Window = 'Normal'}
'2' {$Window = 'Minimized'}
'3' {$Window = 'Maximized'}
}

Write-Color 'Run As Admin:' -Color DarkRed -StartTab 1 -LinesBefore 2
Write-Color '0) ', 'Yes' -Color Yellow, Green
Write-Color '1) ', 'No' -Color Yellow, Green
$modechoose = Read-Host 'Answer'
switch ($modechoose) {
'0' {$RunAs = 'Yes'}
'1' {$RunAs = 'No'}
}

[System.Collections.Generic.List[psobject]]$jsondata.Buttons[$indexnum].Buttons += [PSCustomObject] @{
ID = 0
if ([string]::IsNullOrEmpty($jsondata.Buttons[$indexnum].Buttons.id)) {[int]$ID = 0}
else { [int]$ID = (($jsondata.Buttons[$indexnum].Buttons.id | Sort-Object -Descending | Select-Object -First 1) + 1)}
[System.Collections.Generic.List[psobject]]$TempButtons = @()
$jsondata.Buttons[$indexnum].Buttons | ForEach-Object {$TempButtons.Add($_)}
$TempButtons.Add([PSCustomObject] @{
ID = $ID
Name = $name
Command = $cmd.command
Arguments = $cmd.arguments
Mode = $cmd.mode
Window = $Window
RunAsAdmin = $RunAs
}
$jsondata.Buttons[$indexnum].buttons = $jsondata.Buttons[$indexnum].buttons | Where-Object {$_ -notlike $null}
$jsondata | ConvertTo-Json -Depth 5 | Out-File $PSLauncherConfigFile
$check = Read-Host "Add another button to $($jsondata.Buttons[$indexnum].name) (y/n) "
}
while ($check.ToLower() -notlike 'n')
})
$jsondata.Buttons[$indexnum].Buttons = $TempButtons
$jsondata | ConvertTo-Json -Depth 5 | Out-File $PSLauncherConfigFile
}
if ($GuiAddChoice -eq 6) {
Start-Process -FilePath 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -ArgumentList "-NoLogo -NoProfile -WindowStyle Hidden -ExecutionPolicy bypass -command ""& {Start-PSLauncherColorPicker -PSLauncherConfigFile $($PSLauncherConfigFile)}"""
Expand Down Expand Up @@ -266,22 +263,24 @@ Function Add-PSLauncherEntry {
'1' {$RunAs = 'No'}
}

[System.Collections.Generic.List[psobject]]$TempButtons = @()
$jsondata.Buttons[$indexnum].Buttons | ForEach-Object {$TempButtons.Add($_)}
foreach ($psfile in $files) {
if ([string]::IsNullOrEmpty($jsondata.Buttons[$indexnum].Buttons.id)) {[int]$ID = 0}
else { [int]$ID = (($jsondata.Buttons[$indexnum].Buttons.id | Sort-Object -Descending | Select-Object -First 1) + 1)}

[System.Collections.Generic.List[psobject]]$jsondata.Buttons[$indexnum].Buttons += [PSCustomObject] @{
ID = 0
Name = $name
Command = $cmd.command
Arguments = $cmd.arguments
Mode = $cmd.mode
Window = $Window
RunAsAdmin = $RunAs
}
$jsondata.Buttons[$indexnum].buttons = $jsondata.Buttons[$indexnum].buttons | Where-Object {$_ -notlike $null}
$jsondata | ConvertTo-Json -Depth 5 | Out-File $PSLauncherConfigFile

$TempButtons.Add([PSCustomObject] @{
ID = $ID
Name = $psfile.BaseName
Command = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
Arguments = $psfile.FullName
Mode = 'PSFile'
Window = $Window
RunAsAdmin = $RunAs
})
}
$jsondata.Buttons[$indexnum].Buttons = $TempButtons
$jsondata | ConvertTo-Json -Depth 5 | Out-File $PSLauncherConfigFile
}
if ($GuiAddChoice -eq 5) {
do {
Expand Down Expand Up @@ -352,7 +351,7 @@ Export-ModuleMember -Function Add-PSLauncherEntry
######## Function 2 of 4 ##################
# Function: New-PSLauncherConfigFile
# Module: PSLauncher
# ModuleVersion: 0.1.24
# ModuleVersion: 0.1.25
# Author: Pierre Smit
# Company: HTPCZA Tech
# CreatedOn: 2022/03/20 13:17:14
Expand Down Expand Up @@ -511,7 +510,7 @@ Export-ModuleMember -Function New-PSLauncherConfigFile
######## Function 3 of 4 ##################
# Function: Start-PSLauncher
# Module: PSLauncher
# ModuleVersion: 0.1.24
# ModuleVersion: 0.1.25
# Author: Pierre Smit
# Company: HTPCZA Tech
# CreatedOn: 2022/03/20 13:17:14
Expand Down Expand Up @@ -956,7 +955,7 @@ Export-ModuleMember -Function Start-PSLauncher
######## Function 4 of 4 ##################
# Function: Start-PSLauncherColorPicker
# Module: PSLauncher
# ModuleVersion: 0.1.24
# ModuleVersion: 0.1.25
# Author: Pierre Smit
# Company: HTPCZA Tech
# CreatedOn: 2022/03/20 13:17:14
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions PSLauncher/PSLauncher.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Pierre Smit
#
# Generated on: 2022-07-06 04:13:33Z
# Generated on: 2022-07-06 04:32:09Z
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'PSLauncher.psm1'

# Version number of this module.
ModuleVersion = '0.1.24'
ModuleVersion = '0.1.25'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
Loading

0 comments on commit 91295cc

Please sign in to comment.