How to render multiple files

I start my first and very simple plug and I got that into Rhino
I have W8 x64, VS 2012 and latest Rhino V5 x64

Commande: _AutomateRender
The AutomateRender command will add a line right now.
Commande: _Line
Commande: _Zoom
Dessiner une fenêtre pour zoomer ( Toutes Dynamique Étendu Facteur Avant Arrière Sélection Cible 1Sur1 ): _Extents

I don’t see the coordinate of the line which should be drawed in the command line and nothing is created into the scene !?!
Any help?

using System;
using System.Collections.Generic;
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;

namespace AutomateRender
{
    [System.Runtime.InteropServices.Guid("397c386a-ba54-431e-97e6-88da0b43de42")]
   
    public class AutomateRenderCommand : Rhino.Commands.Command
    {
        public AutomateRenderCommand()
        {
            // Rhino only creates one instance of each command class defined in a
            // plug-in, so it is safe to store a refence in a static property.
            Instance = this;
        }

        ///<summary>The only instance of this command.</summary>
        public static AutomateRenderCommand Instance
        {
            get;
            private set;
        }

        ///<returns>The command name as it appears on the Rhino command line.</returns>
        public override string EnglishName
        {
            get { return "AutomateRender"; }
        }
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {

            Rhino.RhinoApp.WriteLine("The {0} command will add a line right now.", EnglishName);
            Rhino.RhinoApp.RunScript("_Line 0,0,0 10,10,10", true);
            Rhino.RhinoApp.RunScript("_Zoom _Extents", true);
            return Rhino.Commands.Result.Success;
        }
    }
}

Hi there,

You have to tell your command its a scriptrunner

<System.Runtime.InteropServices.Guid("00000-00000-00000-00000-0000000000"), CommandStyle(Style.ScriptRunner)>

guid is an example :wink: but you do need to add the commandstyle.

Thanks very much . it works now :ok_hand:
Here is the solution :

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {

        Rhino.RhinoApp.WriteLine("The {0} command will add a line right now.", EnglishName);

        OpenFileDialog openFileDialog1 = new OpenFileDialog();

        openFileDialog1.InitialDirectory = "c:\\";
        openFileDialog1.Filter = "Modèles 3D de Rhino (*.3dm)|*.3dm|All files (*.*)|*.*";
        openFileDialog1.Multiselect = true;
        openFileDialog1.RestoreDirectory = true;

        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            int Counter = 0;
            foreach (string FullPathName in openFileDialog1.FileNames)
            {
                try
                {

                    Rhino.RhinoApp.RunScript(@"_Open " + FullPathName, true);
                    Rhino.RhinoApp.RunScript("_Zoom _Extents", true);


                    string AnimationOutputDirectory = @"C:\Users\Utilisateur\Documents\Animation\";
                    FileInfo RhinoFileName = new FileInfo(FullPathName);
                    string DirectoryName = RhinoFileName.Name.ToLower().ToString();
                    DirectoryName = DirectoryName.Replace(".3dm", string.Empty);
                    AnimationOutputDirectory = AnimationOutputDirectory + DirectoryName;

                    bool folderExists = Directory.Exists(AnimationOutputDirectory);
                    if (!folderExists)
                        Directory.CreateDirectory(AnimationOutputDirectory);

                    Counter++;
                    if (Counter == 1)
                        Rhino.RhinoApp.RunScript("-_RecordAnimation _TargetFolder " + AnimationOutputDirectory + " _RunAnimation _Enter", true);
                    else
                        Rhino.RhinoApp.RunScript("-_RecordAnimation _TargetFolder " + AnimationOutputDirectory + " _Enter", true);


                }
                catch (SecurityException ex)
                {
                    // The user lacks appropriate permissions to read files, discover paths, etc.
                    MessageBox.Show("Security error. Please contact your administrator for details.\n\n" +
                        "Error message: " + ex.Message + "\n\n" +
                        "Details (send to Support):\n\n" + ex.StackTrace
                    );
                }
                catch (Exception ex)
                {
                    // Could not load the image - probably related to Windows file system permissions.
                    MessageBox.Show("Cannot open the file: " + FullPathName.Substring(FullPathName.LastIndexOf('\\'))
                        + ". You may not have permission to read the file, or " +
                        "it may be corrupt.\n\nReported error: " + ex.Message);
                }
            }
        }
        return Rhino.Commands.Result.Success;
    }