groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Merlin Beedell <MBeed...@cryoserver.com>
Subject RE: Groovy file associations on Windows
Date Mon, 11 Feb 2019 14:57:22 GMT
I use Scriptom – for registering and managing Windows Services (mostly).  I believe that
MS are moving away from the COM model – but I am sure it will be around for a while yet.
 As such it will not change much – and hence the ScriptOM utility is unlikely to need changing
either.

Here is an example:


org.codehaus.groovy.scriptom.Scriptom.inApartment {

    def locator = new org.codehaus.groovy.scriptom.ActiveXObject('WbemScripting.SWbemLocator')

    def services = locator.ConnectServer('.')



<<blaa blaa other stuff!!>



    /* a test to list all cryo services with their dependencies */

    if (testOnly) {

        for(process in services.ExecQuery("SELECT Name FROM Win32_Service where (displayname
like 'cryo%') and StartMode != 'Disabled'", 'WQL', wbemFlagForwardOnly)) {

          println process.Name()

          for (depServ in services.ExecQuery("Associators of {Win32_Service.Name='" + process.Name()
+ "'} Where AssocClass=Win32_DependentService Role=Dependent")) {

                println  "\tDep: ${depServ.DisplayName} state: ${depServ.State}"

          }

          for (depServ in services.ExecQuery("Associators of {Win32_Service.Name='" + process.Name()
+ "'} Where AssocClass=Win32_DependentService Role=Antecedent")) {

                println  "\tAsc: ${depServ.DisplayName} state: ${depServ.State}"

          }

        }

    }

}

Merlin Beedell
0800 280 0525 / +44 (0)207 045 0520
DDI: +44 (0)207 045 0528
Mob: +44 (0)7876 226865
Cryoserver: A focused, flexible email archive delivered by experts

From: Keegan Witt <keeganwitt@gmail.com>
Sent: 11 February 2019 2:24 AM
To: users@groovy.apache.org
Subject: Groovy file associations on Windows

In addition to removing projects that are no longer developed from the Groovy Windows installer
(Gpars, Gaelyk, Scriptom, EasyB, Gant, GMock), I'm considering removing the exe files from
groovy-native-launcher<https://github.com/groovy/groovy-native-launcher>.  These haven't
been compiled in quite a while and are just another thing to maintain.  As I see it, there
are two primary benefits these provide.

  1.  Provide a way to create file associations so you can double click a Groovy file, or
run myFile.groovy instead of groovy myFile.groovy.
  2.  Hide the command window when launching GroovyConsole.
For #2, I can work around this with a VBScript file (or NirCmd).  #1 doesn't have a good way
to solve other than the current native binary solution since Launch4J doesn't support variable
expansion<https://sourceforge.net/p/launch4j/bugs/162/>.  My question is, do many folks
need this functionality?  It's something I've never personally used.  Please weigh in with
your thoughts.

-Keegan
Mime
View raw message