Getting full path of loaded LISP files by ARX

By Xiaodong Liang

Issue
How can I get the full path of loaded LISP applications?

Solution
There are two APIs on the AcApDocument class in ObjectARX that you can use to get this information.

The following is more information on these functions:

virtual int GetCountOfLispList() const;

Returns the number of load LISP files.

virtual AcLispAppInfo* GetItemOfLispList(int nIndex) const;

Returns the descriptor structure for the LISP application designated by nIndex.

Paramters:

nIndex – integer between 0 and GetCountOfLispList()

class AcLispAppInfo
{
     public: TCHAR appFileName[_MAX_PATH];
     bool bUnloadable;
};
Returned by the GetItemOfLispList.
appFileName – full path of the lisp application
bUnloadable – specifies if the lisp application is unloadable

 

static void getLISPFullPathByARX()    {     AcApDocument* pActiveDoc =         acDocManager->mdiActiveDocument();          // count of LISP files    int lispCount = pActiveDoc->GetCountOfLispList();          CString msg;     msg.Format(L"count of LISP file: %d",lispCount);     MessageBox(NULL,msg,msg,0);                // each LISP info
<p style="margin: 0px"><span style="line-height: 140%">&#160;</span><span style="line-height: 140%;color: blue">for</span><span style="line-height: 140%">(</span><span style="line-height: 140%;color: blue">int</span><span style="line-height: 140%"> index = 0 ;</span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; index &lt; lispCount;</span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; index++)</span></p>    <p style="margin: 0px"><span style="line-height: 140%"> {</span></p>    <p style="margin: 0px">&#160;</p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; TCHAR msg1[256] = {0}; </span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; AcLispAppInfo *pEachInfo = </span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pActiveDoc-&gt;GetItemOfLispList(index);</span></p>    <p style="margin: 0px">&#160;</p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; _tcscat( msg1,pEachInfo-&gt;appFileName);</span></p>    <p style="margin: 0px">&#160;</p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; </span><span style="line-height: 140%;color: blue">if</span><span style="line-height: 140%">(pEachInfo-&gt;bUnloadable)</span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160;&#160;&#160;&#160; _tcscat(msg1,L</span><span style="line-height: 140%;color: #a31515">&quot;nloadablen&quot;</span><span style="line-height: 140%">);</span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160; </span><span style="line-height: 140%;color: blue">else</span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160;&#160;&#160;&#160; _tcscat(msg1,L</span><span style="line-height: 140%;color: #a31515">&quot;nunloadablen&quot;</span><span style="line-height: 140%">);</span></p>    <p style="margin: 0px"><span style="line-height: 140%">&#160;&#160;&#160;&#160;&#160; MessageBox(NULL,msg1,msg1,0); </span></p>    <p style="margin: 0px"><span style="line-height: 140%"> }</span></p>    <p style="margin: 0px">&#160;</p>    <p style="margin: 0px"><span style="line-height: 140%">}</span></p> </div>

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading