Previous - sysPrinters Section Home - System Miscellaneous Next - sysFindExe


sysExecute ( )

Performs a predefined operation on an existing file.

Usage:

sysExecute (object me, string operation, string filePath, string parameter, integer windowType)

Parameters:

operation ( string ) - an operation verb registered with the file type. The most common operations are:

edit - launches the document for editing.
explore - explores the folder in parameter filePath
open - opens a file specified by parameter filePath. This can be a file, folder, executable or document.
print - prints the document in parameter filePath.

filePath (string) - a string specifying the file path to an existing file

parameter (string) - if filePath specified an executable, this parameter should be the filePath to a document. If filePath specified a document, this parameter can be EMPTY.

windowType ( integer ) specify how an application is to be displayed when it is opened. The possible values are:

  1. Hidden
  2. Maximized
  3. Minimized
  4. Show
  5. Normal

Returns:

(integer) - The success code

Example1:

-- tell the operating system to issue a print command on the PowerPoint      file
xtRose = xtra("Rosetta").new( )
xtRose.sysExecute( "print", "C:\myPPTfile.ppt", EMPTY, 5 )

Example2:

-- tell the operating system to open the pdf with a registered application  ( usually Adobe Acrobat )
xtRose = xtra("Rosetta").new( )
xtRose.sysExecute( "open", "C:\readme.pdf", EMPTY, 2 )

Example3:

-- tell Director 8.5 to open a demo dir file
xtRose = xtra("Rosetta").new( )

-- find the program file folder, and append Macromedia\Director 8.5\Director.exe to it
strFolder = xtRose.sysFolderSpecial( 8 )
strFilePath = strFolder & "Macromedia\Director 8.5\Director.exe"

-- tell Director to open a demo director file
xtRose.sysExecute( "open", strFilePath, "C:\Sample Demo D7.dir", 4)

Example4:

-- find the CD Drive, and see try to launch projector if the proper CD is in the Drive
xtRose = xtra("Rosetta").new( )
Repeat with i = 99 to 122
  strDriveLetter = numToChar(i)
  If( xtRose.sysDriveType( strDriveLetter) = 6 ) Then
    -- check if our director projector is in the CD Drive
    If ( xtRose.sysFileExist( strDriveLetter & ":\projector.exe" ) ) Then
      return xtRose.sysExecute( "open", strDriveLetter & ":\projector.exe", EMPTY, 5 )
    End If
  End If
End Repeat

Notes:

The windowType argument is passed to the application. It is up to the target application to decide how to handle the windowType, thus not all window types may be supported by all applications.


Previous - sysPrinters Section Home - System Miscellaneous Next - sysFindExe