【问题标题】:Save a shortcut of a .DWG to specified folder by passing file name and folder location通过传递文件名和文件夹位置将 .DWG 的快捷方式保存到指定文件夹
【发布时间】:2023-01-30 04:46:01
【问题描述】:

我正在寻找一个脚本(我相信),以便来自 CAD 的 lisp 可以将文件名和文件夹位置传递给脚本,并将 .DWG 的快捷方式保存在指定的文件夹中。我没有使用脚本的经验。有人可以告诉我该怎么做吗?

我在其他问题之一中发现了这一点,但我不确定它是否是我正在寻找的或如何使其发挥作用。

param ( [string]$SourceExe, [string]$DestinationPath )

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($DestinationPath)
$Shortcut.TargetPath = $SourceExe
$Shortcut.Save()`

【问题讨论】:

    标签: bash shell autolisp


    【解决方案1】:

    在 AutoLISP 中,它将是这样的:

    (defun MakeShortcut ( SourceExe DestinationPath / Shell shortcut ) 
        (setq Shell (vlax-get-or-create-object "Wscript.Shell"))
        (setq shortcut(vlax-invoke-method Shell 'CreateShortcut DestinationPath ))
        (vlax-put-property shortcut 'TargetPath SourceExe)
        (vlax-invoke-method shortcut 'Save)
        (vlax-release-object Shell) 
    )
    
    (MakeShortcut "C:\Program Files\Path\Application.exe" "C:\Test\test.lnk" )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-18
      • 1970-01-01
      • 2016-05-15
      • 2018-02-11
      • 2018-06-26
      • 1970-01-01
      • 1970-01-01
      • 2016-07-14
      相关资源
      最近更新 更多