Code:
;; $shortcut(...)
;; $shortcut(...).TargetPath
;;     Returns the target path
;;
;; $shortcut(...).Description
;;     Returns the shortcuts decription
;;
;; All other supported properties are supported with this script
alias shortcut {
  var %file = $file($$1).longfn
  var %prop = $iif($prop, $v1, TargetPath)   
  var %com1 = $ticks $+ 000, %com2, %res
  while ($com(cmShortCut $+ %com1) || $com(cmShortCutInst $+ %com1)) {
    inc %com1
  }
  %com2 = cmShortCutInst $+ %com1
  %com1 = cmShortCut $+ %com1
  .comopen %com1 WScript.Shell
  if (!$com(%com1) || $comerr) {
    goto error
  }
  elseif (!$com(%com1, CreateShortcut, 3, bstr, %file, dispatch* %com2) || $comerr || !$com(%com2)) {
    goto error
  }
  elseif (!$com(%com2, %Prop, 2) || $comerr) {
    goto error
  }
  else {
    %res = $com(%com2).result
  }
  :error
  if ($com(%com2)) .comclose $v1
  if ($com(%com1)) .comclose $v1
  return %res
}

Last edited by FroggieDaFrog; 02/04/17 11:43 AM.