I certainly use Scriptom (via ‘Jacob’ - a layer to access DCOM – Microsoft’s 
common way to interact with Office suite as well as O/S features like directory 
or service management - that you would typically use vbscript for).
I guess that it is an inactive project because there is no need to further 
refine it – it works really well already.

I use it to start/stop Windows Services, including any dependent services – via 
the wbem api.  And to get server memory and other details.

Groovy (on Windows) would be incomplete without this part of the distribution.

Here are some random snippets showing the sort of thing that I use it for..

import org.codehaus.groovy.scriptom.*;
import static org.codehaus.groovy.scriptom.tlb.wbemscripting.WbemFlagEnum.*;

org.codehaus.groovy.scriptom.Scriptom.inApartment {
    def locator = new 
org.codehaus.groovy.scriptom.ActiveXObject('WbemScripting.SWbemLocator')
    def services = locator.ConnectServer('.')

      for(process in services.ExecQuery("SELECT Name, ProcessID, State FROM 
Win32_Service where (name like '${aCryoServiceName}') and StartMode != 
'Disabled'", 'WQL', wbemFlagForwardOnly)) {
        //for(prop in process.Properties_) {
        //    print "\t${prop.Name} : ${prop.Value}"
        //}
..etc..

boolean checkDependents (def p_serviceCtrl, String p_procName, String depType, 
def p_aW) {
    for (depServ in p_serviceCtrl.ExecQuery("Associators of 
{Win32_Service.Name='" + p_procName + "'} Where 
AssocClass=Win32_DependentService Role=${depType}")) {
            print "\t${depType}: ${depServ.Name} state: ${depServ.State}"
..etc..

   def serviceStates = [
  0:'Success'
  ,1:'Not Supported'
  ,2:'Access Denied'
  ,3:'Dependent Services Running'
  ,4:'Invalid Service Control'
  ,5:'Service Cannot Accept Control'
  ,6:'Service Not Active'


And to obtain O/S details..
//will not run on Linux as scriptom is missing there and the import will fail

String os = System.getProperty("os.name").toLowerCase();

def osIsMacOsX = "mac os x".equals(os);
def osIsWindows = os != null && os.indexOf("windows") != -1;
def osIsLinux = os != null && os.indexOf("linux") != -1;

def localHostName = InetAddress.getLocalHost().getHostName()

if (osIsWindows) {
    org.codehaus.groovy.scriptom.Scriptom.inApartment {
        def locator = new 
org.codehaus.groovy.scriptom.ActiveXObject('WbemScripting.SWbemLocator')
        def services = locator.ConnectServer('.')
        def returnState
        def Kb2Mb = 1024
        def nf = java.text.NumberFormat.getIntegerInstance()
      def proc_query
      proc_query = "SELECT FreePhysicalMemory, TotalVisibleMemorySize FROM 
Win32_OperatingSystem"
      proc_query = "SELECT * FROM Win32_OperatingSystem"
      for (process in services.ExecQuery(proc_query, 'WQL', 
wbemFlagForwardOnly) )
      {
        def mem_free = process.FreePhysicalMemory as Integer
        def mem_Total = process.TotalVisibleMemorySize as Integer
        //def mem_swap = (process.TotalSwapSpaceSize+""?:"0") as Integer
        println ("Free Mem = ${nf.format(mem_free / Kb2Mb)}Mb   Total Mem = 
${nf.format(mem_Total/Kb2Mb)}Mb ")
        println "O/S = $process.Caption [Ver $process.Version] 
$process.CSDVersion [$process.OSArchitecture]\n\n"
        //println "Locale = $process.Locale"
      }
      //  for (process in serviceCtrl.ExecQuery(proc_query, 'WQL', 
wbemFlagForwardOnly) )
    }


Merlin Beedell
From: Keegan Witt [mailto:keeganw...@gmail.com]
Sent: 17 July 2015 02:02
To: Jason Smith
Cc: users@groovy.incubator.apache.org; Guillaume Laforge; Ben Walding
Subject: Re: Scriptom

Others might chime in on the thread.  I don't have a need for it personally 
(I've been deploying to Linux my entire career), but it looks like people still 
use it a bit: 
https://github.com/search?l=groovy&o=desc&q=scriptom&ref=searchresults&s=indexed&type=Code&utf8=%E2%9C%93.
  My interest was just to ensure we have everything properly archived to 
complete the Codehaus migration.

-Keegan

On Thu, Jul 16, 2015 at 8:48 PM, Jason Smith 
<jason.sm...@flatironssolutions.com<mailto:jason.sm...@flatironssolutions.com>> 
wrote:
You found me. I am the guy.

I'm purely Linux now for about 7 years, so I haven't needed Scriptom. Are there 
adopters who need it to be reborn?


Jason Smith | Senior Development Engineer

jason.sm...@flatironssolutions.com<mailto:first.l...@flatironssolutions.com>
Flatirons Solutions, Inc. | Boulder, CO | United States

www.flatironssolutions.com<http://www.FlatironsSolutions.com> | Turning Content 
into Knowledge®

This e-mail and any files transmitted with it may contain confidential 
information and are intended solely for the use of the individual or entity to 
whom they are addressed. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended recipient, please 
inform the sender by reply email and destroy all copies of the original e-mail 
and any documents it might contain. If you are the intended recipient, please 
be advised that the content of this message is subject to access, review and 
disclosure by the sender’s Email Administrator. If you enjoyed all that, you 
are going to love this. Please note that any views or opinions presented in 
this e-mail are solely those of the author and, except for business-related 
information from an authorized representative of FLATIRONS SOLUTIONS, do not 
necessarily represent those of the company. Unless expressly indicated by an 
authorized representative of FLATIRONS SOLUTIONS, this email does not create a 
legal contract that is binding on FLATIRONS SOLUTIONS or its affiliates or 
subsidiaries. FLATIRONS SOLUTIONS accepts no liability for any damage caused by 
any virus transmitted by this e-mail. Thank you for your cooperation.

________________________________
From: Keegan Witt [keeganw...@gmail.com<mailto:keeganw...@gmail.com>]
Sent: Thursday, July 16, 2015 6:42 PM
To: users@groovy.incubator.apache.org<mailto:users@groovy.incubator.apache.org>
Cc: Guillaume Laforge; Ben Walding; Jason Smith
Subject: Re: Scriptom
Addendum: native launcher is already mirrored: 
https://github.com/codehaus/groovy-native-launcher

On Thu, Jul 16, 2015 at 7:47 PM, Keegan Witt 
<keeganw...@gmail.com<mailto:keeganw...@gmail.com>> wrote:
Unfortunately, no.  It was a subproject of Groovy that isn't actively 
maintained.  And actually, I don't think any of these were migrated either

  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/gspec/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/groovy-swt/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/gdata/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/gram/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/xmlrpc/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/groovysoap/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/maven-plugins/
  *   
http://svn.codehaus.org/groovy/trunk/groovy/modules/installers/windows/NSIS-Groovy/
 (but I did an import https://github.com/keeganwitt/groovy-windows-installer)
I think these have already been merged into Groovy and are unneeded

  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/grape-ivy/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/groovy-testng/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/swingxbuilder/
I'm not sure whether these are needed

  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/native_launcher/
  *   http://svn.codehaus.org/groovy/trunk/groovy/modules/beansbindingbuilder/

If anybody knows which ones we need to pull, please speak up.  I'm not sure 
which of these projects had documentation pages (I'd bet at least a few had 
none), but personally I'm more concerned about getting the sources than the 
docs.

-Keegan


On Thu, Jul 16, 2015 at 7:05 PM, Ben Walding 
<ben.wald...@gmail.com<mailto:ben.wald...@gmail.com>> wrote:

On 17 Jul 2015, at 7:07 am, Guillaume Laforge 
<glafo...@gmail.com<mailto:glafo...@gmail.com>> wrote:

Hi Keegan,

On Thu, Jul 16, 2015 at 10:15 PM, Keegan Witt 
<keeganw...@gmail.com<mailto:keeganw...@gmail.com>> wrote:
I've never had cause to use this functionality, so forgive my ignorance.  Where 
did this repo move after the Codehaus shutdown?  
http://svn.codehaus.org/groovy/modules/scriptom/trunk/ It doesn't look like it 
was included in the Codehaus mirrors<https://github.com/codehaus/>.

Indeed, I don't think it's been moved anywhere.

Groovy migrated themselves out - I didn't take a copy of their SCM repos.  All 
repositories that I could find clones of on the internet were migrated to 
github (codehaus) account.  If the original owner pesters me I remove the repos 
from the codehaus account / provide links to the new locations.



And did the 
documentation<https://web.archive.org/web/20150102213228/http:/groovy.codehaus.org/COM+Scripting>
 get moved as well?

No it hasn't moved either.

There is a backup of Confluence - but it is non-trivial to restore things from.

Wasn't this migrated with the Groovy project?

Regards,

Ben



Reply via email to