Author Topic: Creating Windows Shortcuts has stopped working  (Read 1120 times)

0 Members and 1 Guest are viewing this topic.

BazzaCAD

  • Guest
Creating Windows Shortcuts has stopped working
« on: September 14, 2018, 06:21:12 PM »
I've used the code below to create Windows Shortcuts to network folders for years, but for some reason over the last few days it has shopped working for everyone in the office.
All I can think of is a Windows Update has broke something.
Anyone have any ideas?

Code - Auto/Visual Lisp: [Select]
  1. (defun CreateShortcut (Name favFldr Path / )
  2.   (if (= wshLibImport nil)
  3.     (progn
  4.       (vlax-import-type-library :tlb-filename (strcat (dos_specialdir 37) "wshom.ocx") ;_ "c:\\windows\\system32\\wshom.ocx"
  5.                           :methods-prefix "wshm-"
  6.                           :properties-prefix "wshp-"
  7.                           :constants-prefix "wshk-"
  8.       )
  9.       (setq wshLibImport T)
  10.     )
  11.   )
  12.  
  13.   (setq wshShell (vlax-create-object "WScript.Shell"))
  14.   (setq shrtObj (wshm-CreateShortcut wshShell (strcat favFldr "\\" Name ".lnk")))
  15.   (vlax-put-property shrtObj 'IconLocation (strcat *MasterServerPath* "startup\\Icons\\Acad.ico"))
  16.   (vlax-put-property shrtObj 'TargetPath Path)
  17.   (vlax-invoke-method shrtObj 'Save)
  18. )
  19.  


The .lnk file is created, but when you double click on it, nothing happens. If I call the .lnk file from the command line, I get "The data is invalid" message box & "Access is denied" at the command line...

« Last Edit: September 14, 2018, 06:24:33 PM by BazzaCAD »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Creating Windows Shortcuts has stopped working
« Reply #1 on: September 14, 2018, 07:04:04 PM »
The access denied would indicate that it is a security/permissions issue that is preventing you from saving to that location. My suggestion is to check with your IT department to see if they changed something recently.