Eloquintet 发表于 2007-8-24 10:56:17

必须添加对Windows脚本主机对象模型的引用'这比注册表类所需的一行接一行的代码要好得多
你用过VLAX吗。Frank O的cls 它可以很好地从VBA计算LSP表达式
Public Sub Vlax_Product_Key()
    Dim obj As VLAX
    Dim Key As String
    Dim Prof As String
   
    Set obj = New VLAX
    Key = obj.EvalLispExpression("(vlax-product-key)")
    Prof = obj.EvalLispExpression("(getvar ""cprofile"")")
   
    Debug.Print "HKEY_CURRENT_USER\" & Key & "\Profiles\" & Prof & "\Dialogs\Plot Stamp\PlotStamp"
End Sub

Eloquintet 发表于 2007-8-24 11:07:16

不,我从来没有真正学习过VLisp,在lisp中使用vl的东西,所以我从来没有在VBA中探索过它 从哪里得到的?

Eloquintet 发表于 2007-8-24 11:10:22

我在上一个回复中发布的文件中有它。

Eloquintet 发表于 2007-8-24 13:23:20

嘿伙计们哇你'我一直很忙。我在acad中已经有了一些代码。lsp(命令-plotstamp)
打开它,但我正在寻找一种更简单的方法,如果在会话期间用户绘图时关闭它,它就会重新打开。我想我可以通过将其添加到我使用的绘图和发布按钮中来实现这一点,但我的老板说,有时她会使用这些按钮,但有时她会键入绘图,在这种情况下,它不会#039;t打开它。那'这就是为什么我认为使用事件路径更好,如果发出plot或publish命令,则打开plotstamp;我现在想要?

Eloquintet 发表于 2007-8-24 13:38:47

好的……给你 使用Duh's的WshShell思想(您需要添加一个引用)和VLAX。此处为cls'这就是我想到的 附件中包含了您需要的所有内容Option Explicit
Public strPlotStampLocale As String
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
    Dim oWsh As WshShell
    GetPlotStampLocation
    Select Case UCase(CommandName)
      Case Is = "PUBLISH"
            Set oWsh = New WshShell
            oWsh.RegWrite strPlotStampLocale, "1", "REG_DWORD"
            Set oWsh = Nothing
      Case Is = "PLOT"
            Set oWsh = New WshShell
            oWsh.RegWrite strPlotStampLocale, "1", "REG_DWORD"
            Set oWsh = Nothing
    End Select
End Sub
Private Sub GetPlotStampLocation()
    Dim obj As VLAX
    Dim Key As String
    Dim Prof As String
   
    Set obj = New VLAX
    Key = obj.EvalLispExpression("(vlax-product-key)")
    Prof = obj.EvalLispExpression("(getvar ""cprofile"")")
   
    strPlotStampLocale = "HKEY_CURRENT_USER\" & Key & "\Profiles\" & Prof & "\Dialogs\Plot Stamp\PlotStamp"
End Sub
页: 1 [2]
查看完整版本: 如何确保打印和发布时plotstamp始终处于打开状态