Announcement

Collapse
No announcement yet.

exec() or system() calls in EFS?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • exec() or system() calls in EFS?

    Greetings,

    I'm trying to find a function that will execute another application, and pass arguments. The returned data is not important.

    Is this at all possible without having to take the DLL approach?

    Thanks,
    Joshua C. Bergeron

  • #2
    Hello Joshua,

    Other than the DLL approach, I'm not sure. But if there were such a function in JavaScript 1.5 you would find it at the link below.

    Core JavaScript 1.5 Reference
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Joshua:

      An interesting question... probably would require using DLL calls. While I have not tried this specific example, it would probably work.

      var d = new DLL("shell32.dll");

      function preMain()
      {

      d.addFunction("Exec", DLL.INT, DLL.STDCALL, "ShellExecuteA", DLL.INT, DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.INT);

      }

      function main(){

      var windowhandle = null;
      d.call("Exec", windowhandle, "open", "notepad.exe", "mydoc.txt", null, 1);

      }

      As I said I have not tested this and it is definitely used at your own risk. I don't think the window handle (1st parameter) is required, but if it is you can get that by using...

      d2 = new DLL("user32.dll");

      d2.addFunction("GetHandle", DLL.INT, DLL.STDCALL, "GetFocus");

      WindowHandle = d2.call("GetHandle");

      Chris
      Last edited by ckryza; 03-05-2003, 09:55 AM.

      Comment


      • #4
        That's an excellent idea Chris, I will try that just for kicks and let you know how it goes.

        I'm already just about done converting my code to act as a DLL though, but thanks for the information guys!

        Cheers,
        Joshua C. Bergeron

        Comment

        Working...
        X