Skip to content

Commit

Permalink
Test if already running / messagebox
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiesendanger committed Aug 28, 2020
1 parent 9b67b70 commit 3af92a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Binary file modified ADSKDashboard.exe
Binary file not shown.
30 changes: 20 additions & 10 deletions ADSKDashboard.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
Clear-Host
# get ADSKDashboard process
# Check if an instance is already running / if yes kill it and start new / didnt found a way to get the instance and maximize
$ADSKDashboard = Get-Process ADSKDashboard* -ErrorAction SilentlyContinue
Write-Host $ADSKDashboard.Id
if ($ADSKDashboard.Length -gt 1) {
Write-Host "Already Running!"

$ButtonType = [System.Windows.Forms.MessageBoxButtons]::OK

$MessageIcon = [System.Windows.Forms.MessageBoxIcon]::Information

$MessageBody = "Already Running!"

$MessageTitle = "Error"

$Result = [System.Windows.Forms.MessageBox]::Show($MessageBody, $MessageTitle, $ButtonType, $MessageIcon)

exit
}

#Initialize
[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | out-null
[System.Reflection.Assembly]::LoadWithPartialName('WindowsFormsIntegration') | out-null
Expand All @@ -22,15 +41,6 @@ else {
$PathShell = Split-Path -Parent -Path ([Environment]::GetCommandLineArgs()[0])
}

# get ADSKDashboard process
# Check if an instance is already running / if yes kill it and start new / didnt found a way to get the instance and maximize
$ADSKDashboard = Get-Process ADSKDashboard -ErrorAction SilentlyContinue

if ($ADSKDashboard) {
Write-Host "Already Running!"
Stop-Process $ADSKDashboard
}

##############################################################
# Config #
##############################################################
Expand Down

0 comments on commit 3af92a4

Please sign in to comment.