X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 05 Sep 2013 08:52 AM by  anon
How to execute simple batch file from Windows command line?
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
05 Sep 2013 08:52 AM
    Hello, On the long run, I would like to perform some repeating tasks on a huge number of images. The main analysis is done with Python, but some parts can only be performed in ENVI. Therefore, I would like to create a function in IDL, which can be called from Python. I'm still at the very beginning. Right now, I would like to accomplish the following: Create a procedure/function in IDL, that: can be called from a Windows command line accepts an input argument I thought this should be rather simple, but it doesn't seem so. Here are some things I've tried so far: 1. In Windows command line: idl -e 'print, "123test"' Output: IDL Version 8.0.1 Microsoft Windows [...] Installation number: xxxxxx Licensed for use by: xxxxxx However, it doesn't print "123test". 2. Typing the following command: idl -e "t=DIALOG_MESSAGE('123test')" works as expected (a dialog box with "123test" opens). 3. I created a file called "test.pro" with this content: print, "123test" t=DIALOG_MESSAGE('123test') exit I start IDL by typing "idl" from the windows command prompt. Then, in the IDL command line, I type @test "123test" is then printed to the IDL command line, the '123test'-Dialog box opens, and then it exits to the Windows command line. 4. I tried to call the file from the Windows command line using: idl -e ".run 123test" idl -e ".run 123test.pro" idl -e '.run 123test' idl -e '.run 123test.pro' idl -e '@123test' However, each time, the only output is: IDL Version 8.0.1 Microsoft Windows [...] Installation number: xxxxxx Licensed for use by: xxxxxx Nothing else. I actually tried a lot of other things as well, but nothing worked. So, the question is: How can a IDL batch file be executed from the Windows command line?

    Deleted User



    New Member


    Posts:
    New Member


    --
    06 Sep 2013 10:30 AM
    There are ways to call a batch file via IDL command line options, but you might be interested to know that there are also python packages that let you call IDL directly from python. Try here: http://michaelgalloy.com/2012/07/30/i...

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Sep 2013 05:11 AM
    Thanks for your answer. I just spent 1 hour trying to setup pIDLy, but without success. This might be due to the fact that I'm working on a Windows PC, and some dependencies of pIDLy are rather complicated to install. That's maybe the reason why "Test on Windows" is still on the todo-list on the pIDLy-Homepage. Therefore, I would prefer a solution which calls the batch file from the system command line. Any ideas? :)

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Sep 2013 07:17 AM
    What if you use single quotes around your print statement. >idl -e, "print, '123test'" You could also try the example in the help: idl -e "PLOT, SIN(FINDGEN(628)/100) & t=DIALOG_MESSAGE('Done')" Does this work?

    Deleted User



    New Member


    Posts:
    New Member


    --
    10 Sep 2013 03:35 AM
    MariM wrote: What if you use single quotes around your print statement. >idl -e, "print, '123test'" You could also try the example in the help: idl -e "PLOT, SIN(FINDGEN(628)/100) & t=DIALOG_MESSAGE('Done')" Does this work? The "PLOT, [...]" example works, but using single quotes in "print, [...]" doesn't work. Anyway, I now discovered envipy.RunTool(), which allowed me to do exactly what I want. So, problem solved! ;)
    You are not authorized to post a reply.