From 3af92a461f01b2818590c22f0f763480af4293ad Mon Sep 17 00:00:00 2001 From: TWiesendanger Date: Fri, 28 Aug 2020 16:32:15 +0200 Subject: [PATCH] Test if already running / messagebox --- ADSKDashboard.exe | Bin 368128 -> 369152 bytes ADSKDashboard.ps1 | 30 ++++++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ADSKDashboard.exe b/ADSKDashboard.exe index d229263caabf49480d92eed71f149828241dacbe..04ffa2bece3f9673024f3a449031806ca3a763fd 100644 GIT binary patch delta 2235 zcma)8TTGi}7=FKB$P$Ra?AXH4Kshyv7iFbWhE6#Z%Au^KCpr_Q{H2AqP#AUVW&#-| z9u|_#Pt)iX3&!Z8Q6$O@MzgpZ#*4 z^B(@ruOFWO`tapfYkoWAe4g^Z4bnuhC?*;cL?;T=>Gr~vYyQIb7X%H-LUEy}K*wD* zuEyl+qEW=;=fWbE0>r?ej)*6wV}x~g}y z#+>}B%Bb1!-Ezn2f)JC)9p&<2A zhQegS+D^k*J(R-!7&TLrd{`57hC&n|J6UnwgMFvE=lzH}Z^FGByT0s}O;pM1>4tJU z%!S|rhe~J|#`@$h)0WzPiqkn52~(1EWuikt3Bk1+QUhT2_m_^y=cc`O7j-D0QF7v~ z4VrG6BtNut>ZTS-ZP(Pw`(-buCb?t>6KkSWy69-^~z)pfDcDXtQ2<_PU5J*BExHMqz+P${}!60N) zpoIeu(TlK?gy)zFC4qey!GkU-uA6GRaFc+94LD+uJ_gSn%996qZ~~)Mo}F%S-VaK@ z$|w`Yv@2bBaw1wkGS4VlC?n1PR8}~E&hY9-&UHokeNh@DFDN^%$|Z(SbQq4p!G4tW z;y#3|#o>ap>OqM2rpgbn36K%S>f4bELs&;nJ?i2Zc<@mK`*w)-E3ErF+{;mF-`ui( z#BeCZOu2B$s@s(^tS@E1DH3(EB=SkCu391q*Bl!sr5o6|WoAL36$a8c?*^fhickm6 zxHV9rax=0bFOEJ`ABPqvnE~^fgfwe$s+keiKC>fT9EUHXG`i$7`i+A<@Wp#>$26of z^1;Z*EjHN7CS@09oOh=XF{^ItP0^ zuY2KP6p-Cu$^2#I(;0ww1FQ`h;BKCT?I~ymI14H`7x?GC=fSDxhqN(Zqw@Q0bEz@O zypZ9{rR3GO%4?foljGr1;X>n4-4E{XB1*m;Z?kxyU>m|x?NwLv?r zW`zSjc^)~z?SH=$6Kg9bvFa%M>DI`Jn>VW3KD(i#BPSG%{>1C2halv`Mo@ z(7=SM=w?0W2cyWO;15Nx1lKH_MFIG1`m^C@7f=)=2cwzs`^YB^W zO32qlzevf;qE~FnpM?Fvc?9uq0*^)}nmA7M%ZMPh7LDx-!d-h>`|hxIt}Y+$zNppe z@@ltD`?M}^c8_UaHFw|F7C^MBXnKh`a6Z$oa`dbOd3{Mxpx zooUEn`}D!h22syUm<|sMGNVpUU}ka*>%egBeft;3M*jMFid=M-GBig~nxrCyDL@{o zP>Q_dpcAk;;4M)c{ty)q7eRc17AQ+IGQV`excrP5ly?1N8A^BbJ19o0l!Vg>kT8OW z01(5PqBT{7K@uoBD0lU1N4UHPWs|CGNkwwTG%`G-t9==fU+xQ#ANDy4%Tr6+J*R=2 zBsVB!fELDXTvheM7FShs(xz`4m4o7#?9=VCBXj=flnR*zF($-ixa+%whG+~>ZVFNc zspn*)5Z#xBcLi3Td?WXX@taxn_1x zvtjMyLBy`=~GeQI2I24bq+=E3pUaAdO`Pji*+8#ejP?G_I+n1(Dm z7|ekrY1xOrI6OPFqR8)%qVqg|5 zfN;KXJU?8}jrQ`m^0S~n4bL7tEjw+CrrVEcRfn;0OY9n#ZiySlr8Uv}FCrISZvX%Q diff --git a/ADSKDashboard.ps1 b/ADSKDashboard.ps1 index 57a157d..3f673e0 100644 --- a/ADSKDashboard.ps1 +++ b/ADSKDashboard.ps1 @@ -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 @@ -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 # ##############################################################