Uniface User Forum

 View Only
  • 1.  Spawn on .msg file

    PARTNER
    Posted 01-17-2023 08:00
    Hi,

    We use "spawn" command to open files from our runtimes. It works well for all Windows files (.doc, .docx, .txt, ...) except from .msg files for which we have this info : "The command line argument is invalid. check the switch you are using."
    Is there a way to solve this problem ?

    Thanks for advance.

    Laurent.


    ------------------------------
    Laurent MEROT
    Proges Plus
    Willems FR
    ------------------------------


  • 2.  RE: Spawn on .msg file

    ROCKETEER
    Posted 01-17-2023 08:52
    Hi Laurent,

    The spawn command will try to determine the executable associated with a .msg file by calling the Windows function FindExecutable(), which returns something like (e.g.):
    • "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
    It then appends a space and the name of the file, and there we have the command line to execute. This works in many situations, but not with programs like Outlook which need an extra command line switch (in this case -f) to run their argument. Because we don't have the -f, it does not work.

    A very simple workaround for cases like this is to delegate the work to the Windows Command Prompt (cmd.exe). E.g.
    • spawn("cmd /C myemail.msg")

    That works fine but it leaves you with an ugly DOS box in the middle. You could get rid of this by using a signature with the implementation Operating System (OS) Command. E.g.
    • activate "OSCMD".COMMAND("cmd /C myemail.msg")

    Or another option would be to spawn a command like:
    • spawn("outlook -f tmp.msg")

    I hope this helps.

    ------------------------------
    Daniel Iseli
    Principal Technical Support Engineer
    Uniface Services
    Rocket Software, Switzerland
    ------------------------------



  • 3.  RE: Spawn on .msg file

    PARTNER
    Posted 01-20-2023 02:17
    Hi Daniel,
    It works very weel as you described, thanks !
    Regards,
    Laurent.

    ------------------------------
    Laurent MEROT
    Proges Plus
    Willems FR
    ------------------------------