| 本帖最后由 wowan1314 于 2013-7-11 21:23 编辑 
 乱搞了两个脚本,一个是一键发送LSP到CAD,一个是一键发送当前选中文本到CAD。
 脚本文件拷贝进记事本,扩展名改为VBS。加载的方法同猫分享的那个一样。
 我搞的这个不会激活CAD至当前窗口(不是不想搞,是不会搞)。
  '加载当前lsp到CAD
Dim STR , ARR 
  SET ARR = WScript.Arguments
    For Each s1 In ARR
       STR = STR & " " & S1
    Next
Set objCAD = GetObject(, "AutoCAD.Application")
If Err Then '如果AutoCAD应用程序没有启动,进行下面的处理
    Err.Clear
    MsgBox " 未打开CAD程序:"
        Else
                Set ThisDrawing = objCAD.activedocument
                STR = replace (STR , "" ,"/")
                ThisDrawing.SendCommand ("(load """ & STR & """)" & vbCr)
                Set ARR = Nothing
                Set STR = Nothing
                Set ThisDrawing = Nothing
                Set objCAD = Nothing
End If
 '加载当前选中文本内容到CAD
Set objCAD = GetObject(, "AutoCAD.Application")
If Err  Then '如果AutoCAD应用程序没有启动,进行下面的处理
    Err.Clear
    MsgBox " 未打开CAD程序:"
        Else
                Set ThisDrawing = objCAD.activedocument
                Dim STR , ARR 
                SET ARR = WScript.Arguments
                For Each s1 In ARR
                    STR = STR & " " & S1
                Next
                If STR="" Then 
                MsgBox " 当前未选中:"
                Else
                STR = TRIM(STR)
                ThisDrawing.SendCommand ( STR & vbCr)
                End If 
                Set ARR = Nothing
                Set STR = Nothing
                Set ThisDrawing = Nothing
                Set objCAD = Nothing
End If
 |