groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Corum, Michael" <>
Subject RE: Scriptom
Date Fri, 17 Jul 2015 12:21:26 GMT
I definitely use Scriptom and have used it for several projects.


From: Merlin Beedell []
Sent: Friday, July 17, 2015 3:59 AM
Cc: Guillaume Laforge; Ben Walding; Jason Smith
Subject: RE: Scriptom

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}"

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}"

   def serviceStates = [
  ,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("").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 []
Sent: 17 July 2015 02:02
To: Jason Smith
Cc:<>; 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:
 My interest was just to ensure we have everything properly archived to complete the Codehaus


On Thu, Jul 16, 2015 at 8:48 PM, Jason Smith <<>>
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<>
Flatirons Solutions, Inc. | Boulder, CO | United States<> | Turning Content into

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 [<>]
Sent: Thursday, July 16, 2015 6:42 PM
Cc: Guillaume Laforge; Ben Walding; Jason Smith
Subject: Re: Scriptom
Addendum: native launcher is already mirrored:

On Thu, Jul 16, 2015 at 7:47 PM, Keegan Witt <<>>
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

(but I did an import
I think these have already been merged into Groovy and are unneeded

I'm not sure whether these are needed


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.


On Thu, Jul 16, 2015 at 7:05 PM, Ben Walding <<>>

On 17 Jul 2015, at 7:07 am, Guillaume Laforge <<>>

Hi Keegan,

On Thu, Jul 16, 2015 at 10:15 PM, Keegan Witt <<>>
I've never had cause to use this functionality, so forgive my ignorance.  Where did this repo
move after the Codehaus shutdown?
It doesn't look like it was included in the Codehaus mirrors<>.

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<>
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?



View raw message