method to obtain TARGET of a shortcut

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Michel
Newbie
Posts: 17
Joined: Fri May 20, 2011 2:12 pm
Location: Ottawa

method to obtain TARGET of a shortcut

Post by Michel » Thu Aug 18, 2011 7:37 pm

This is a follow up question to a "LiveLink" query

http://www.mjtnet.com/forum/viewtopic.php?t=6986

I have a shortcut icon of type .LNK on my desktop to a Livelink folder

Right click properties on said shortcut I obtain something to the effect for "Target"

Target : "L:\LiveLink system \Drop report here"

I'm able to create a script to copy file to "Target"

CopyFile>%Here_is_one_of_the_reports%,L:\LiveLink system \Drop report here\Here_is_one_of_the_reports.pdf

.. which is cool.
However each report has its own folder on LiveLink.. Different TARGETs.

Now here is my question:

Is there a way to obtain "Target" from a shortcut-?

If so.. then I could get the ""L:\LiveLink system \Drop report here" as a LiveLink variable

CopyFile>%File_name%,%A_livelink_variable%\Here_is_the_report.pdf


Thanx
... Michel

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Aug 18, 2011 9:13 pm

Try this and let us know.

Code: Select all

Let>File=Path and name.lnk

VBSTART
  Function GetProp(Prop)
    dim wshShell, propOb        
    Set wshShell = CreateObject("WScript.Shell")      
    Set propOb = wshShell.CreateShortcut(Prop)      
    GetProp = propOb.TargetPath
  End Function
VBEND

VBEval>GetProp("%File%"),res
MessageModal>res

List of properties that can be retrieved. (There may be others.) Just substitute one of these for the word "TargetPath" in the script.

Arguments
Description
FullName
IconLocation
Hotkey
TargetPath
WindowStyle
WorkingDirectory

Michel
Newbie
Posts: 17
Joined: Fri May 20, 2011 2:12 pm
Location: Ottawa

Post by Michel » Fri Aug 19, 2011 1:22 pm

Brilliant-!

Thanx JRL

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts