|
|
@@ -5,33 +5,38 @@ $env:WINIMAGER = $PSCommandPath
|
|
|
$env:PSLIB = [System.IO.Path]::Combine($PSScriptRoot, "LibWinImager.psm1")
|
|
|
Import-Module -Name $env:PSLIB
|
|
|
|
|
|
-if ($Script -eq $null){
|
|
|
+while ($true){
|
|
|
|
|
|
- $items = Get-ChildItem ([System.IO.Path]::Combine($PSScriptRoot,"bin"))
|
|
|
- $items
|
|
|
+ if ($Script -eq $null){
|
|
|
+ $items = Get-ChildItem ([System.IO.Path]::Combine($PSScriptRoot,"bin"))
|
|
|
+ $items
|
|
|
|
|
|
- ""
|
|
|
+ ""
|
|
|
|
|
|
- $dia = GuiSelectDialog ($items|foreach {$_.Name}) -Title "Select Command" -Label "Select Command"
|
|
|
- $result = $dia.form.ShowDialog()
|
|
|
- $result
|
|
|
+ $dia = GuiSelectDialog ($items|foreach {$_.Name}) -Title "Select Command" -Label "Select Command"
|
|
|
+ $result = $dia.form.ShowDialog()
|
|
|
+ $result
|
|
|
|
|
|
- if ($result -eq "OK"){
|
|
|
- $Script = ($items| where {$_.Name -eq $dia.listbox.selecteditem}).FullName
|
|
|
- } else {
|
|
|
- "Abort"
|
|
|
- Break
|
|
|
+ if ($result -eq "OK"){
|
|
|
+ $Script = ($items| where {$_.Name -eq $dia.listbox.selecteditem}).FullName
|
|
|
+ } else {
|
|
|
+ "Abort"
|
|
|
+ Break
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
-
|
|
|
-$logpath = LogFilePath ([io.path]::GetFileNameWithoutExtension($Script))
|
|
|
-$logpath
|
|
|
+ $logpath = LogFilePath ([io.path]::GetFileNameWithoutExtension($Script))
|
|
|
+ $logpath
|
|
|
|
|
|
-try{
|
|
|
- &$Script | Tee-Object -FilePath $logpath
|
|
|
-} catch {
|
|
|
- Write-Error $_.Exception | Tee-Object -FilePath $logpath -Append
|
|
|
- pause
|
|
|
+ try{
|
|
|
+ &$Script | Tee-Object -FilePath $logpath
|
|
|
+ $Script = $null
|
|
|
+ } catch {
|
|
|
+ Write-Error $_.Exception | Tee-Object -FilePath $logpath -Append
|
|
|
+ "An error Occurred. Save $logpath before continuing..."
|
|
|
+ pause
|
|
|
+ Break
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|