PDA

View Full Version : Deleting shortcuts from script editor



JerryS@cat
06-05-2014, 01:43 PM
Ran into some trouble trying to delete shortcuts (.lnk files) from the script editor. No error is returned; it simply doesn't work. In looking through the forum, I noticed someone bringing this to light back in June of 2013, and the response was that it was a bug that was accidentally brought forward into SB8, but that it would be fixed on the next service release for SB8. It's been a year now, and I'm wondering if this was really addressed yet since it still seems to be an issue. I've had to resort to calling a CMD/BAT file just to delete the .lnk files since the Delete File(s) command doesn't seem to want to do it.

linder
06-06-2014, 02:15 AM
Jerry,

Hmmm, I do not remember any issue with removing shortcuts at installer runtime. A shortcut is nothing more than a file and it can be removed via the "Delete File(s).." script function. IMO, you just point to an incorrect folder. There is no need to call a .bat file to remove the shortcut file(s)!

If you are interested, tell me the location of your shortcut and send your project file (.sb8) to support [at] lindersoft [dot] com and we can tell you exactly what the problem is.

Friedrich

linder
06-06-2014, 02:20 AM
Jerry,

BTW, I think you are referring to the following thread, right?

http://www.lindersoft.com/forums/showthread.php?p=70601

It was not possible to delete the "Create Shortcut" script line from the script (IDE issue at design time). It was not a delete shortcut problem at installer runtime!

Fixed in SetupBuilder 8.0 Build 4092 (June 22, 2013)
FIX : [SB#3-06081] IDE: Regression in the Shortcuts removal function caused by [SB#2-06301].

Friedrich

linder
06-06-2014, 03:16 AM
Jerry,

I have created a demo (please see attached screenshots and project file links).

http://www.lindersoft.com/projects/JerryLnk.zip

The 'JerryCreate.sb8' compiled install creates a "Jerry XYZ" shortcut folder, a "RegEdit App" shortcut and a "RegEdit App" desktop shortcut (which point to the Windows Registry Editor).

The 'JerryDelete.sb8' compiled app removes the "RegEdit App" shortcut, the "Jerry XYZ" shortcut folder and the "RegEdit App" desktop shortcut without any problem.

Does this help?

Friedrich

JerryS@cat
06-06-2014, 09:06 AM
I realize it should be this simple (as your example shows). As most programmers do at some point, I will probably discover it is some simple mistake I'm making and smack myself in the head, but my code looks just like yours and I've run it in debug mode to make sure I'm pointing at the correct folder. I will have to play with it some this weekend again to see if I can determine what's wrong. The only difference that I'm seeing between your code and mine is that you're deleting the shortcut from the Common Program and Common Desktop while I'm attempting to delete from a specific user's profile. Yes, I do have admin rights to do so while I'm running. Let you know more next week if I discover my error.

And yes, that post you pointed out was the one I was referring to.
Thanks for taking the time to post a response.

linder
06-06-2014, 10:31 AM
Hi Jerry,

I think your real 'problem' is that you are trying to delete the Shortcut from a specific user's profile on an UAC-aware operating system (e.g. Windows 7 or Windows 8, etc.)? By Windows design, it is not possible to handle a "per-user" action from an elevated ("per-machine") running application. Why? Because you are doing the action in a wrong user context. But I am not 100% sure you are doing this! For example, you are trying to delete the Shortcut from the "JoeUser" Standard User account and your installer is running (over-the-shoulder?) elevated and accesses the "Admin" account (and not the specific user's profile).

It's similar to this:

http://www.lindersoft.com/forums/showthread.php?t=20795

If you don't do the above "per-user" action from an elevated running app then please ignore my comments <g>

Friedrich

JerryS@cat
06-10-2014, 12:57 PM
You are correct, Friedrich. Thank you for the assistance.

linder
06-10-2014, 01:16 PM
You are very welcome, Jerry !!!

Friedrich