Posted by israelb in SWF Studio V3 on Aug 04 2008, 01:57 pm

help...this is my code

on(release){

ssCore.Shell.execute({path:"..\\Lanzador.exe"})
}

but no executed "Lanzador.exe"


Posted by northcode in SWF Studio V3 on Aug 04 2008, 05:32 pm

The Shell.execute command (and every command that takes a "path" argument) requires that the path be a fully qualified path (must include the names of all directories in the file's path). What you have supplied is a relative path. The ".." means the parent of the current directory. If you want to get the parent directory of the application start dir, you can do it lilke this.


function GetParentFolder(path:String) : String
{
   // remove leading and trailing white space
   
   for (var i:Number=0; path.charCodeAt(i) < 33; i++);
   for (var j:Number=path.length-1; path.charCodeAt(j) < 33; j--);
   path = path.substring(i, j+1);
   
   // remove trailing slash (if present)
   
   if (path.charAt(path.length-1) == '\\')
      path = path.substring(0, path.length-1);
      
   // remove the last element from the folder path   
   
   var index:Number = path.lastIndexOf("\\");
   path = path.substring(0, index);
   
   // return the parent folder 

   return path;
}
Once you have that function, you can call launch your EXE like this:


on (release)
{
   var p:String = GetParentFolder(ssGlobals.ssStartDir);
   ssCore.Shell.execute({path:p+"\\Lanzador.exe"})
}