SmartBear_Suppo
14 years agoSmartBear Alumni (Retired)
Share your components here
So, you have made a custom loadUI component that you think might be useful to other users? Well, go ahead and post it in this topic and it will be published at loadui.org/Custom-Components.
Below is a template that you can use when posting:
[hr:3haswfjc][/hr:3haswfjc]
Component name:
Process Runner
Developer:
Ole Lensmar, eviware
Description:
Runs an operating system process. Example component taken from http://www.eviware.com/blog/?p=196.
Source code:
Below is a template that you can use when posting:
[hr:3haswfjc][/hr:3haswfjc]
Component name:
Process Runner
Developer:
Ole Lensmar, eviware
Description:
Runs an operating system process. Example component taken from http://www.eviware.com/blog/?p=196.
Source code:
/**
* Runs a process
*
* @name Process Runner
* @category runners
*/
// the command itself
createProperty('command', String,"")
sample = { message, sampleId ->
try
{
// start a process and wait for it to finish
def proc = command.value.execute()
proc.waitFor()
// add result properties
message["ExitValue"] = proc.exitValue()
message["Stdout"] = proc.in.text
message["Errout"] = proc.err.text
// fail if process failed
if( proc.exitValue() != 0 )
failureCounter.increment()
}
catch( e )
{
// add error properties
message["ExitValue"] = -1
message["Errout"] = e.message
failureCounter.increment()
}
return message
}
layout {
property( property:command, label:"Command", constraints: 'w 200!' )
action( label:'Run Once', action: { triggerAction('SAMPLE') }, constraints: 'aligny bottom' )
}