Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to run a program without opening a new window  (Read 10428 times)

0 Members and 1 Guest are viewing this topic.

IMartins

    Topic Starter


    Rookie

    Re: How to run a program without opening a new window
    « Reply #15 on: June 25, 2008, 11:50:34 AM »
    Hi, speed is only an issue with the /wait solution. My goal is to have a batch that runs commands on MATLAB and FLUENT without opening a new MATLAB or FLUENT window! Thank you!

    Isabel

    llmeyer1000



      Intermediate

      Thanked: 1
      Re: How to run a program without opening a new window
      « Reply #16 on: June 26, 2008, 08:36:16 AM »
      My best shot is to have each of the programs feed the solution file to the other once it's ready!

      You just lost me!  ??? I am not familiar with either program, but I would "guess" that you would have to run one program with the start /wait [/b] command, so that the results file(s) would be available for the second program when it runs. (But that is as I said only a guess.) Your best bet, is to post detailed information on this site, so that one of the guru's(not me) can help you out. If you give Dias enough information, you have a shot at a solution.


      Note to BC_Programmer:

      Strange- I only use the start command when I want to load up a document from the command prompt. Why? Well, Start internally calls the ShellExecute (or ShellExecuteEx) APIs, which definitely are not the best way to execute a Program. Rather, I use their direct name, since as far as I can tell command prompt starts processes in that case with the CreateProcess API, which is must faster. So Start wins for flexibility, but if your going for speed, directly entering the name is the way to go.

      Hey BC, You may very well be right about the API issue. I don't have a clue about that.
      I was speaking from my own experience. I had a working batch file in Windows XP, that called up a program as you suggest with just the program name. But ... the batch file failed in windows Vista because it simply would not run the program without the start command. It was then that I also learned about the need to always use the "title". I realize that many people are slow about going to Vista, but I figure that sooner or later, most of us will have to make the switch.  :( Anyway, from that experience, I made the suggestion to always use the start command.

      IMartins

        Topic Starter


        Rookie

        Re: How to run a program without opening a new window
        « Reply #17 on: June 26, 2008, 10:22:40 AM »
        Ok, what I want is to create a batch that opens and runs a fluent journal file, like
        start "" /B /wait fluent -g -i journal_file
        then, I want that after the journal is read and the results are in a file, created by the journal file, the batch runs the open window of MATLAB to read this file and perform another series of calculations, which it should do with
        start "" /B /wait matlab -nodesktop results_file
        and this sequence goes on for an x number of times.
        The problem is that each of these start comands is opening a new window, it's as if /B wasn't being read!

        Thanks,
        Isabel

        llmeyer1000



          Intermediate

          Thanked: 1
          Re: How to run a program without opening a new window
          « Reply #18 on: June 27, 2008, 09:22:25 AM »
          OK, let's forget about the start command for a bit. (Maybe Dias has an idea why the /B is being ignored.)

          I think we are going to need a lot more details, if there is any hope for a batch file resolution to your problem.

          Fluent & Matlab must be DOS programs, Right?

          Are you running Fluent & Matlab in Windows XP in a CMD window, or in some other version of Windows or DOS?

          I take it that you can get the results you want, if you run the commands from the CMD window, in the proper sequence, and that now you want to automate the process with a batch file. Right?

          Can you explain exactly what commands you are using at the command line and the procedure for inputting the data from the results file that works for you(from the command line).

          Also what do you mean by this:
          My goal is to have MATLAB give an initial set of conditions to FLUENT, trough a file it writes and that is loaded as the journal, and after FLUENT reads the file and executes the commands, it creates another file, that is "fed" into MATLAB, and they keep doing this in sequence for an x number of times.

          What is the purpose of "feeding" the data from one program to the other repeatedly, as you describe?

          I hate to say it, but this all sounds very complicated, and may be very difficult to accomplish, especially, considering the fact that the Matlab forum guys are stuck also.
          I've seen in a matlab forum that maybe tracking the matlab session id, but neither they nor I have any idea how this can be done!

          Explain everything you do at the command line in extreme detail, & maybe .....

          Also, how about a link to the matlab forum discussing this problem.

          IMartins

            Topic Starter


            Rookie

            Re: How to run a program without opening a new window
            « Reply #19 on: June 27, 2008, 02:27:32 PM »
            Hi again, the matlab post link goes below,
            http://www.mathworks.com/matlabcentral/newsreader/view_thread/165823#421971
            Maybe you're right about the complication of the process, but the idea seems quite simple and attainable! Both MATLAB and FLUENT are GUI programs tha also run with a built-in command line, not from DOS. The program is supposed to calculate in MATLAB a set of refrigeration temperatures, record it in a file and then that file is read, with FLUENT, that then simulates a short period of time, to gives a new state of refrigeration, i.e. air properties, that are to be read by MATLAB and then used a new calculation. And this process goes on until the time period of the simulation chosen is through. Was I clear?  ??? ;D
            The file that FLUENT is going to read has simple line instructions, something like:
            file
            read-case
            temperatures_file
            simulate
            ...
            This is then saved as a journal file, an extension .jou that is understood by FLUENT.
            I've come across a solution to force MATLAB to wait until the files with the results from FLUENT are ready to resume its calculations, but I can't do the same with FLUENT, it doesn't offer those capabilities. So, right now, half of the problem is solved, but I still need FLUENT to run from a batch file that MATLAB is going to write without opening a new window, to resume its previous simulation!

            Thanks,
            Isabel