5 Replies Latest reply on Mar 31, 2008 2:04 PM by

    Easy solution for missing shell execution?

    alad_iim
      Hello!

      Because I really miss the feature to start an external application from my AIR application, I thought about a solution which is easy to implement and doesn't need too much configuration effort on the user's side. I'm not a really good programmer so I hope we can find out together if this solution is fine.

      The idea is to run a daemon on the user's computer which monitors a watchfolder. The AIR application writes the shell commands in a file in the watchfolder. The daemon reads the command in the file an executes this command. For knowing something about the status of the external program, the daemon should write a log file with the outputs of the external application. This logfile can be read by the air application.

      This means for the AIR application:
      - Implementing a class, called "ShellExecution" for example with the methods
      * run (path:String) : starts an external application
      * kill (AppID:Integer) : kills an external application
      * setWatchfolder(path:String) : sets the path to the watchfolder
      and with the events
      * changeStatus : occurs when the logfile changes
      * completed: occurs when the external application completed
      * failed: occurs when the external application couldn't be started
      Please remember: This are only my non-professional ideas... :-)

      The daemon should be programmed in C/C++ I think to make it platform independent, the tasks for the daemon are:
      * monitoring the watchfolder (every 1 second for example)
      * if there is a "run-file": start the command inside the file
      * create a log file for this "run-file" and writing outputs and status information to the file

      Well, these are my first ideas on that. What do you think about it?
      I guess it's not too hard to implement for a C/C++ developer and it should really run on win, linux and mac.
      And the AIR side should be easy too.
      We only have to ensure that the daemon is running on the user's machine. But for my clients this could be easy to ensure. There could be a batch-file which first starts the daemon and then the air application. If the AIR application shuts down, it could write something to the watchfolder and the daemon shuts down one second later...

      Would be very happy th get some reply and ideas about this topic.
      Hope my english was good enough to explain what I want :-)

      Thanks and regards,
      Andreas