+ Reply to Thread
Results 1 to 4 of 4

SHELL to open an application and pass parameters to it

  1. #1
    Registered User
    Join Date
    07-12-2005
    Posts
    3

    SHELL to open an application and pass parameters to it

    I have a compiler that operates on an XML file to create a BGL graphics file.

    At a command prompt, the syntax is [bglcomp.exe test.xml] and the output would be test.bgl.

    Trying to automate this in the macro that creates the XML code, and with both files in path C:\Temp, I tried:

    ID = Shell("C:\Temp\bglcomp.exe test.xml")

    This runs with no error messages, but does not compile the XML file. What is the correct method?

  2. #2
    Jim Thomlinson
    Guest

    RE: SHELL to open an application and pass parameters to it

    You could try...

    ID = Shell("command.com /c C:\Temp\bglcomp.exe test.xml")

    --
    HTH...

    Jim Thomlinson


    "jwkz" wrote:

    >
    > I have a compiler that operates on an XML file to create a BGL graphics
    > file.
    >
    > At a command prompt, the syntax is [bglcomp.exe test.xml] and the
    > output would be test.bgl.
    >
    > Trying to automate this in the macro that creates the XML code, and
    > with both files in path C:\Temp, I tried:
    >
    > ID = Shell("C:\Temp\bglcomp.exe test.xml")
    >
    > This runs with no error messages, but does not compile the XML file.
    > What is the correct method?
    >
    >
    > --
    > jwkz
    > ------------------------------------------------------------------------
    > jwkz's Profile: http://www.excelforum.com/member.php...o&userid=25167
    > View this thread: http://www.excelforum.com/showthread...hreadid=386635
    >
    >


  3. #3
    Registered User
    Join Date
    07-12-2005
    Posts
    3
    Jim, thanks for the suggestion.

    Your statement also runs without error, and delivers a valid ID number, but does not compile the xml file.

    I then tried putting a [,1] at the end to keep the app window open, to see if there were any error messages there. However, the command prompt window just flashes briefly, then closes. Unlike the old DOS window in Win98, there seems to be no way to tell it to remain open after the app terminates.

    John

  4. #4
    Registered User
    Join Date
    07-12-2005
    Posts
    3
    For anyone else interested, there were two problems, now resolved.

    1) Shell wants cmd, not command to open the command window

    2) The "Temp" path in my example was really a nest of folders, and included the "Program Files" folder. But the Shell command used would not accept the two-word folder name.

    Restructuring the syntax as follows gives a successful result. It passes two sequential commands, the first a DOS change directory to open the folder, followed by the executable and the xml file it is to compile.

    x = Shell("cmd /c cd C:\Program Files\Subfolder&&bglcomp.exe test.xml")

    Could also have been done by calling a batch file, but this seems cleaner.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1