mdm.Process() This page was last modified over 30 day(s) ago and has 3 comment(s)


Back to Process Class Summary

Availability
Windows, Mac OSX, Linux

Constructor
mdm.Process(application:String, args:String, startFolder:String)

Parameters
app:String - Path to the Application
args:String - Arguments to pass to the Application
startFolder:String - The working directory of the Application

Returns
instance of newly created mdm.Process object or null

Description
Creates a Process instance.

Notes
None

Example Code
/*
* simple example - launch Safari.app process with specific web page address
*/
private var process:mdm.Process = null;
// then
var app:String = "/usr/bin/open";
var params:String = "-n -a Safari.app http://www.bbc.co.uk";
var startDir:String = "/";
process = new mdm.Process(app, params, startDir);


/**
* complex sample
* create instance of TextEdit application with specific file
* if it is already open then forcefully close it
*/
// this is process instance
// it is unique on its own and it does not require
// instance process ID
private var process:mdm.Process = null;
//
protected function startProcessHandler(event:MouseEvent):void
{
// was this process already created
if(process != null)
{
// is this process still running?
// if so kill it (forcefully close)
if(process.isOpen() == true)
{
var killed:Boolean = process.kill();
};
// release
process = null;
};
// create new process
var app:String = "/usr/bin/open";
var params:String = "-t data.txt";
var startDir:String = mdm.Application.path;
process = new mdm.Process(app, params, startDir);
}

/*
* run other application (named OurBrowser.app) and pass arguments to it and read it back in started app
*/

var app:String = "/usr/bin/open";
var params:String = "-a OurBrowser.app --args firstArgument secondArgument thirdArgument";
var startDir:String = mdm.Application.path;
var process:mdm.Process = new mdm.Process(app, params, starter);

in started application:
mdm.Application.getCMDParams(1)
mdm.Application.getCMDParams(2)
mdm.Application.getCMDParams(3)

mdm.Process Class Example Downloads
Simple Process Example


User Comment by Darkpaldin on 23rd October 2012 - 14:04
How to hide the open process window as zinc3 done

User Comment by Terry on 21st February 2013 - 15:54
Yeah, how to open a process in the background, so the window isn't visible??

User Comment by Terry on 21st February 2013 - 15:55
Looks like the "complex sample" is Mac only, right? How would you do the "/usr/bin/open" part on Windows?

Registered Users must be logged in to 'MyAccount' to add a Comment - Log In Here
  After Logging In, Click Here to Refresh This Page