Passing arguments to the command line from Groove script IJC

User 247c00dc1d

29-10-2012 11:23:41

Hello!


I have the code:


 


import com.im.commons.progress.*


import com.im.df.api.dml.*


import com.im.df.api.support.SelectionDescription


import org.openide.awt.HtmlBrowser.URLDisplayer


import java.net.URL


import java.net.URLEncoder




evaluate = { widget ->


    // here is an example of interesting objects accessible through passed parameters


    def dataTree = widget.form.resultSet.dataTree


    def parent = dataTree.rootVertex.entity


    def rs = parent.schema.dataProvider.getDefaultResultSet(dataTree, false, DFEnvironmentRO.DEV_NULL)


    def parentVS = rs.getVertexState(dataTree.rootVertex)


    


    // do the work here


    field = null


    for(f in parent.fields.items) {


        if (f.name.equals("Smiles")) {


            field = f


        }


    }


    iupac = com.im.ijc.widgets.abstractwidget.FieldHelper.getCurrentValue(parentVS, field, true)


    a =print 'D:\\abc\\prg.exe xz "' + iupac + '"\n'


    print a    


}


 


This code returns the following string:


D:\abc\prg.exe xz "smile"


How to pass those arguments to the command line?


Thank you!

User 247c00dc1d

29-10-2012 12:58:44

solution has been found:


 


import com.im.commons.progress.*


import com.im.df.api.dml.*


import com.im.df.api.support.SelectionDescription


import org.openide.awt.HtmlBrowser.URLDisplayer


import java.net.URL


import java.net.URLEncoder




evaluate = { widget ->


    // here is an example of interesting objects accessible through passed parameters


    def dataTree = widget.form.resultSet.dataTree


    def parent = dataTree.rootVertex.entity


    def rs = parent.schema.dataProvider.getDefaultResultSet(dataTree, false, 




DFEnvironmentRO.DEV_NULL)


    def parentVS = rs.getVertexState(dataTree.rootVertex)


    // do the work here


    field = null


    for(f in parent.fields.items) 


{


        if (f.name.equals("Smiles"))


         {


            field = f


         }


}


    iupac = com.im.ijc.widgets.abstractwidget.FieldHelper.getCurrentValue(parentVS, field, true)


    a =print 'D:\\abc\\prg.exe xz "' + iupac + '"\n'


    print a 


    Runtime r = Runtime.getRuntime();


    Process p = null;


    p = r.exec('D:\\abc\\prg.exe xz "' + iupac + '"\n');