osCmd("string to run on system" [, whether to wait for a result])
var dirList twPan.osCmd("cmd /c dir/b \"c:\temp\some folder\"", true);
twPan.osCmd("cmd /c notepad \"c:\sopme where\my File.txt\"");
//%: osCmd(commandText [, waitResponse]) : string | void ;
osCmd : function(){
var waitResponse = false;
// this.alert(this.osCmd.arguments.length);
switch(this.osCmd.arguments.length)
{
case 0:
var retVal = {'status': twConst.SystemAccess_NotAttempted};
break;
case 1:
var retVal = TW.system(this.osCmd.arguments[0]);
break;
case 2:
waitResponse = this.osCmd.arguments[1];
var retVal = TW.system(this.osCmd.arguments[0], waitResponse);
break;
} // End. switch(this.osCmd.arguments.length)
switch(retVal.status)
{
case twConst.SystemAccess_NotAttempted:
this.alert('Please Specify a Command\n - that the System can Run');
break;
case twConst.SystemAccess_OK:
if (waitResponse == true) {return retVal.output; }
// otherwise no return should be expected
break;
case twConst.SystemAccess_Failed:
this.alert(retVal.message
+ '\nCode: '+ retVal.result // may be empty
+ '\n\n' + retVal.output); // may be empty
// even if (waitResponse == true) {return nothing ; } and fail script
break;
case twConst.SystemAccess_PermissionDenied:
this.alert(retVal.message);
return '';
break;
} // End. switch(retVal.status)
}, // End. twPan.osCmd(commandText [, waitResponse])
Created with the Personal Edition of HelpNDoc: Free iPhone documentation generator