
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, everyone
I'd like to execute an appload command without the dialogue box.
I don't know how to do that, so I wrote PowerShell codes below:
# PowerShell codes
[System.Windows.Forms.SendKeys]::SendWait("_appload ") [System.Windows.Forms.SendKeys]::SendWait("%n") # Alt+N [System.Windows.Forms.SendKeys]::SendWait("xyz.lsp") [System.Windows.Forms.SendKeys]::SendWait("%(lc)") # Alt+L & Alt+C
and run it.
But I don't like SendWait because it runs asynchronously, that is, it doesn't wait until the command finishes. Instead, I'd like to do that like next:
# PowerShell codes
$acad = New-Object -ComObject AutoCAD.Application $doc = $acad.Documents.ActiveDocument $doc.SendCommand("(command `"_appload`" `"xyz.lsp`")") # This doesn't work
The last line causes the dialogue box, but `xyz.lsp' isn't entered to the text box in it.
Does anyone have a good idea? I don't care if you use another command except appload.
I use AutoCAD 2011 on Windows 7.
I'd like to draw tens of cross sectional views, and each view has hundreds of LWPolylines. I have as many AutoLISP files as sections to draw. Each file (like xyz.lsp) is for a section drawing.
Thank you.
Solved! Go to Solution.