[how To?]close A Specific Session Of Samurize?

hi all,

i know open a specific session of samurize with the .vbs(from Tadis i guess,no??):

Set WshShell = WScript.CreateObject("WScript.Shell") 
set oShell = CreateObject("Shell.Application")

strSamPath = WshShell.RegRead ("HKCUSoftwareSerious SamurizeGeneralDirPath")

SAMURIZE_DIRECTORY = strSamPath

KillClient

Wscript.sleep (100)
Set oExec = WshShell.Exec(SAMURIZE_DIRECTORY & "Client.exe " & """session name""")

Set oExec = Nothing
Set WshShell = Nothing



Function KillClient
Dim objWMIService, colProcessList, objProcess, PID
Set objWMIService = GetObject("winmgmts:.rootcimv2")
Set colProcessList = objWMIService.ExecQuery("select * from Win32_Process where CommandLine LIKE '%Client.exe%" & "session name" & "%'")
For Each objProcess in colProcessList
PID = objProcess.ProcessID
killPID(PID)
Next
End Function

Function killPID(PID)
Dim WshShell
Set WshShell = CreateObject("wscript.shell")
WshShell.run "taskkill /PID " & PID, 0
End Function

but i wish to close any specific samurize session with a buttons or shortcut. :rolleyes:

how can i make it?

thanks

#116336

Let me get this right:

do you want to kill/end/close a specific instance/session of samurize or are you asking how to close all instances/sessions? :blink:

[edit]Also, what version of windows are you using (if XP: Home or Professional?)[/edit]

#116408

i use windows xp pro,and i want to kill a specific session of samurize.

by exemple i got on my desk 3 specific session/config of samurize(so 3 client.exe procesus with 3 names of session different):

cd covers,pod and vertical pod

i wish to kill cd covers when no music play with a buttons but keep pod and vertical pod.

it can be very usefull i think ;)

#116480

Try this:

INSTANCE = "Pod"  ' <<<=== Change this variable to the name of the instance you want to kill.

'==============================================================
'==============================================================

Set WshShell = WScript.CreateObject("WScript.Shell")

KillClient

Set WshShell = Nothing

Function KillClient
 Dim objWMIService, colProcessList, objProcess, PID
   Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
   Set colProcessList = _
   objWMIService.ExecQuery("select * from Win32_Process where" & _
   " CommandLine LIKE '%Client.exe%" & INSTANCE & "%'")
   For Each objProcess in colProcessList
     PID = objProcess.ProcessID
     killPID(PID)
   Next
End Function

Function killPID(PID)
 Dim WshShell
 Set WshShell = CreateObject("wscript.shell")
 WshShell.run "taskkill /PID " & PID, 0
End Function

;)

#116498

wonderfull :woot:

thank you very much,i think it can be very usefull to make multi-tabs groups of config that can be open/close when needed (Y)

(a global controller that open/close others config like weather,music etc....)

#116504

It's working great !

You can further automate process by adding two advancedmediaplugin/getaudioinfo text meter.Make them blank and set first one to alert value over '0' (zero) and link to execute 'client.exe CDCovers' , and set second one to alert value under '1' and link to execute Tadis's script.That way when you start playing music CDCovers instance will automatically start and when quit will end...

Tadis - you really make this program rolling :rock:

#116514

yep it's working very well :rock:

but can we make a mix of the two vbs?:

the first make open the session:

Set WshShell = WScript.CreateObject("WScript.Shell")
set oShell = CreateObject("Shell.Application")

strSamPath = WshShell.RegRead ("HKCU\Software\Serious Samurize\General\DirPath")

SAMURIZE_DIRECTORY = strSamPath

KillClient

Wscript.sleep (100)
Set oExec = WshShell.Exec(SAMURIZE_DIRECTORY & "\Client.exe " & """pod""")

Set oExec = Nothing
Set WshShell = Nothing



Function KillClient
 Dim objWMIService, colProcessList, objProcess, PID
   Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
   Set colProcessList = objWMIService.ExecQuery("select * from Win32_Process where CommandLine LIKE '%Client.exe%" & "pod" & "%'")
   For Each objProcess in colProcessList
     PID = objProcess.ProcessID
     killPID(PID)
   Next
End Function

Function killPID(PID)
 Dim WshShell
 Set WshShell = CreateObject("wscript.shell")
 WshShell.run "taskkill /PID " & PID, 0
End Function

the second close the session:

INSTANCE = "Pod"  ' <<<=== Change this variable to the name of the instance you want to kill.

'==============================================================
'==============================================================

Set WshShell = WScript.CreateObject("WScript.Shell")

KillClient

Set WshShell = Nothing

Function KillClient
Dim objWMIService, colProcessList, objProcess, PID
  Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  Set colProcessList = _
  objWMIService.ExecQuery("select * from Win32_Process where" & _
  " CommandLine LIKE '%Client.exe%" & INSTANCE & "%'")
  For Each objProcess in colProcessList
    PID = objProcess.ProcessID
    killPID(PID)
  Next
End Function

Function killPID(PID)
Dim WshShell
Set WshShell = CreateObject("wscript.shell")
WshShell.run "taskkill /PID " & PID, 0
End Function

to make a uniqque .vbs that open the session if it closed and close it if it's open? :rolleyes:

thx

:weightlift pro:

edit:it kills samurize session but not the entire client procesus,is it possible to kill the client also?(but just of this session)

i ask very much, i hope i'm not disturbing you ;)

#116525

Originally posted by crni@Feb 19 2004, 07:50 PM

It's working great !

You can further automate process by adding two advancedmediaplugin/getaudioinfo text meter.Make them blank and set first one to alert value over '0' (zero) and link to execute 'client.exe CDCovers' , and set second one to alert value under '1' and link to execute Tadis's  script.That way when you start playing music CDCovers instance will automatically start and when quit will end...

Tadis - you really make this program rolling  :rock:

yes!

great idea :lol:

#116526

Originally posted by crni@Feb 19 2004, 08:50 PM

It's working great !

You can further automate process by adding two advancedmediaplugin/getaudioinfo text meter.Make them blank and set first one to alert value over '0' (zero) and link to execute 'client.exe CDCovers' , and set second one to alert value under '1' and link to execute Tadis's  script.That way when you start playing music CDCovers instance will automatically start and when quit will end...

Tadis - you really make this program rolling  :rock:

Glad to help, I like to see the innovative ideas flowing! keep them coming guys. ;)

#116816

A stupid question, when u use the script .vbs to do that (or any thing else)... It take more memory or CPU? :pchawk:

#133427

no real difference ;)

it's very usefull to commands instance of samurize (Y)

#133444

@derek

Apologies for not seeing your amended request before (the on/off script):

Const strInstance = "SuiteWeather" '<=== Your Instance Name

OpenClose

Function OpenClose()
'On Error Resume Next
Dim objWMIService, colProcessList, WshShell
Set objWMIService = GetObject("winmgmts:root\cimv2")
Set colProcessList = objWMIService.ExecQuery("select * from Win32_Process where CommandLine LIKE '%Client.exe%" & strInstance & "%'")
Set WshShell = CreateObject("WScript.Shell")

strSamPath = WshShell.RegRead ("HKCU\Software\Serious Samurize\")

intCount = 0

For Each objProcess in colProcessList
  intCount = True
Next

If intCount = False Then
  WshShell.Exec(strSamPath & "\Client.exe " & chr(34) & "i=" & strInstance & chr(34))
Else
  KillClient
End If

Set objWMIService = Nothing
Set colProcessList = Nothing
Set WshShell = Nothing
End Function

Function KillClient
Dim objWMIService, colProcessList, objProcess, PID
  Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
  Set colProcessList = objWMIService.ExecQuery("select * from Win32_Process where CommandLine LIKE '%Client.exe%" & strInstance & "%'")
  For Each objProcess in colProcessList
    PID = objProcess.ProcessID
    killPID(PID)
  Next
End Function

Function killPID(PID)
Dim WshShell
Set WshShell = CreateObject("wscript.shell")
WshShell.run "taskkill /PID " & PID, 0
End Function

Just change the constant 'strinstance' to whichever instance you want to switch on/off and create a link to this script. ;)

#133684

thx very much (Y)

#133690