Page 1 of 1

How to create multiple shorcuts to the same target

Posted: Mon Aug 16, 2010 1:19 pm
by KevinTX
Hi,

My installer needs to create a shortcut (to the same target file) in each of the Photoshop's Plug-ins directory. See the following code example:

Code: Select all

Read Registry Key HKLM\SOFTWARE\Adobe\Photoshop\10.0\PluginPath\ into PSPLUGINDIR
if Variable PSPlUGINDIR not Equals
   Create Shortcut $PSPLUGINDIR$\myplugin to $TARGETDIR$\Plugins\myplugin
end
Read Registry Key HKLM\SOFTWARE\Adobe\Photoshop\11.0\PluginPath\ into PSPLUGINDIR
if Variable PSPlUGINDIR not Equals
   Create Shortcut $PSPLUGINDIR$\myplugin to $TARGETDIR$\Plugins\myplugin
end
Read Registry Key HKLM\SOFTWARE\Adobe\Photoshop\12.0\PluginPath\ into PSPLUGINDIR
if Variable PSPlUGINDIR not Equals
   Create Shortcut $PSPLUGINDIR$\myplugin to $TARGETDIR$\Plugins\myplugin
end
Only the last Create Shortcut actually did the creation. The first two did not create any shortcut (all three registry keys exist and have valid values).
Also, I would like to use Goto Label command to do a loop, but it does not allow defining label inside conditional statement.

Thanks,

Re: How to create multiple shorcuts to the same target

Posted: Mon Aug 16, 2010 2:15 pm
by mills
The reason only the last link is being created is because the shortcuts aren't created until Apply Install is called.
Thus, the value of PSPLUGINDIR at that time is whatever it was last set to.

I do think that is by designed, but I see where you're coming from, so I'll double check whether the script should behave in such a way as to remember a variable's value at the time it was called.

In the mean time, just use a unique variable for each path.

~~~

The help doc does state "If the GoTo Label is called while inside a conditional block, the block will be immediately exited."

So, let me see what's going on there...

Re: How to create multiple shorcuts to the same target

Posted: Mon Aug 16, 2010 2:31 pm
by KevinTX
Thanks. Using different variable for each path works.

Re: How to create multiple shorcuts to the same target

Posted: Mon Aug 16, 2010 3:22 pm
by mills
I found that using the same variable to store the path will work if the name of each shortcut differs.

As for the label issue, are you getting the following message when compiling:
LABEL_error.jpg
LABEL_error.jpg (28.2 KiB) Viewed 4859 times

Re: How to create multiple shorcuts to the same target

Posted: Thu Aug 19, 2010 11:50 am
by KevinTX
Yes, that is exactly the error message that I was getting.

Re: How to create multiple shorcuts to the same target

Posted: Thu Aug 19, 2010 1:05 pm
by mills
Then, you must be defining a label within an if block. You can place GoTo statements in an if block, but not a label definition.