PDA

View Full Version : Conditional Creation of Shortcut on Desktop



griffo
08-20-2010, 04:38 PM
I have searched the help, the examples and this message board for an answer to this problem I have.

In the Additional Tasks example, it shows how to ask and test if Desktop shortcuts should be added. But not how to actually add the shortcut.

In this forum, I see plenty of messages that thrash out the various issues, but I still cannot get it to work. I have tried all three candidate CSIDL values but none work. Here is what have tested with. I am testing this on a VMware virtual XP machine.


If %SHORTCUTDT% Equals "1" Then
Create Shortcut "LMS RESOLVE Configure" to Custom\%_CSIDL_DESKTOPDIRECTORY%\LMS RESOLVE Configure
Create Shortcut "LMS RESOLVE-CDD" to Custom\%_CSIDL_DESKTOPDIRECTORY%\LMS RESOLVE-CDD
Create Shortcut "LMS RESOLVECCDD" to Custom\%_CSIDL_COMMON_DESKTOPDIRECTORY%\LMS RESOLVECCDD
Create Shortcut "LMS RESOLVECD" to Custom\%_CSIDL_DESKTOP%\LMS RESOLVECD
Refresh Desktop()
End

Should not at least one of these work?

Thanks

John Griffiths

linder
08-22-2010, 10:49 AM
John,

Are you sure your "If Statement" is executed at all? Just add a "Display Message Box" function insite the If Statement to check this. I am sure it is not displayed.

'If %SHORTCUTDT% Equals "1" Then' only works if you have a checkbox in a custom dialog. If you are using a checkbox in a standard dialog then you have to use the 'Equals "1" on Position' option.

BTW, I would suggest to use the Shortcut Visualizer to add the above shortcuts. And it's not a good idea to mix per-user and per-machine shortcuts (you are doing this in your code snippet).

If you are interested, you can send your .sb7 project to support (at) lindersoft (dot) com and we'll fix it for you.

Friedrich

linder
08-22-2010, 10:56 AM
You sent via private message:

My message from yesterday still awaiting moderation may be deleted. I found my problem where I was not testing the Checkbox result as a bitfield :-( All fixed now
John Griffiths

Thank you for the update! I found the private message after I answered it :( But I think it's a good idea not to delete it so others can learn from it.

Thanks,
Friedrich

griffo
08-24-2010, 08:09 AM
John,

'If %SHORTCUTDT% Equals "1" Then' only works if you have a checkbox in a custom dialog. If you are using a checkbox in a standard dialog then you have to use the 'Equals "1" on Position' option.

Yes, that is where I was going wrong.



BTW, I would suggest to use the Shortcut Visualizer to add the above shortcuts. And it's not a good idea to mix per-user and per-machine shortcuts (you are doing this in your code snippet).


I just added all three CSIDL locations whilst trying to see which one might work. After I fixed my IF test error, I ended up using the %_CSIDL_DESKTOP%. This seems to work fine.

Thanks

John Griffiths

linder
08-24-2010, 08:36 AM
Perfect! Thanks for the update, John.

Friedrich