[CommandMethod("OpenFileWithoutAlias", CommandFlags.Session)]
public void OpenFileWithoutAlias()
{
PromptOpenFileOptions pofo
= new PromptOpenFileOptions
("\nEnter File"); pofo.PreferCommandLine = false;
pofo.DialogName = "Select File";
pofo.Filter = "dwg files (*.dwg)|*.dwg";
pofo.DialogCaption = "Select File";
//pofo.InitialDirectory = Intial directory to open to
//pofo.InitialFileName = Intial file to use;
PromptFileNameResult pfnr = Application.DocumentManager.MdiActiveDocument.Editor.GetFileNameForOpen(pofo);
if (pfnr.Status != PromptStatus.OK) return;
Document doc = Application.DocumentManager.Open(pfnr.StringResult);
string cmd = String.Concat("CommandAfterOpen", " ", pfnr.StringResult, "\n");
doc.SendStringToExecute(cmd, true, false, false);
}
[CommandMethod("CommandAfterOpen", CommandFlags.NoHistory)]
public void CommandAfterOpen()
{
PromptStringOptions pso
= new PromptStringOptions
("\nEnter File"); pso.AllowSpaces = true;
PromptResult pr = Ed.GetString(pso);
if (pr.Status != PromptStatus.OK) return;
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nDoing Work");
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nNoHistory so user will not run it again by pressing enter");
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nDoing with with file " + pr.StringResult);
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nWork Done");
}