WScript Object
Unable to access
Wednesday, April 23, 2008 by Electo | Discussion: DesktopX
I have a DX script that accesses the WScript COM object directly (if "directly" is the right word) instead of through the CreateObject function. When I try to run the script, DesktopX gives me the error, "Object required: wscript". Here's an example of what I'm doing:
If wscript.arguments.count=0 Then msgbox "Drop files on me to extract the icons."
I've seen other users use WScript like that (while I was searching the forums to solve my problem
Ultimately, I am trying to extract an icon from an EXE/DLL/any PE file using a script I found from http://gilpin.us/IconSiphon/. I copied and pasted the code from the .vbs file into my object's script editor, but I get that "object required" error. Possibly copying/pasting is the problem? Do I have to run the script in some other way, like right from the file? After looking at MSDN for WScript, it seems like it has to do with the file itself.
Any ideas why WScript isn't working would be appreciated.
Thanks,
Electo
Reply #2 Saturday, April 26, 2008 3:09 PM
You can find the script at the website that I wrote in the original post:
http://gilpin.us/IconSiphon/
I realize that, but it doesn't work very well using that by itself. If you want to move the object so it is aligned with other icons inside the background, the label doesn't even move with it. Plus, you can't change the label without going into the Object Properties window. I was looking for a way to easily drag programs into the list (as a client) while arranging them at the same time.
Reply #3 Saturday, April 26, 2008 11:26 PM
To position the shortcuts you could use a grid function. Every time you add a shortcut, basically this would check that the icon doesn't go past the edge.
Reply #4 Saturday, April 26, 2008 11:46 PM
Does this mean that you somehow got rid of the icon label through script? If I could know how to do that, I'd be able to figure it out from there. I've already written a script to arrange text shortcuts, but I want to retain the shortcut's icon as well.
Reply #5 Monday, April 28, 2008 10:00 PM
There are two examples. One single and the second will clone shortcuts in a grid when they are dropped on the base container. There's an issue with folders in the second one.
See the screenshot below.
http://www.box.net/shared/0x8i9wj4sw

Reply #6 Tuesday, April 29, 2008 5:13 PM
Thanks, SirSmiley. I appreciate your time. I probably would have just thrown away the icon extraction idea. I should be able to incorporate it into my own theme now.
Reply #7 Tuesday, April 29, 2008 5:49 PM
Reply #8 Tuesday, April 29, 2008 6:40 PM
Have you got a positive results with this?
I think it would be great to get folder icon (and any other that you need) directly from shell32.dll. It seems this code should work but I have no free time to check up this idea.
May be you know more easy way than dll parsing?
Reply #9 Tuesday, April 29, 2008 8:04 PM
Unless I'm able to solve all these bugs before I get bored of it (I give up easily
I searched quite a while for a method to get a file's icon in VBScript, and this script is all I came up with, though there might be another method that I didn't find.
Actually, if you're asking for an easier way to get just the folder icon, I'd think you could just extract the icon from shell32.dll yourself with a program like Resource Hacker and then use that .ico file.
Reply #10 Tuesday, April 29, 2008 8:16 PM
Reply #11 Tuesday, April 29, 2008 8:55 PM
Ok. One day I'll find free time and make this code. Hope this will be much soon.
Reply #12 Wednesday, April 30, 2008 12:00 AM
I noticed some errors but, have been using it mostly with shortcuts and it seems to work most of the time. Noticed the issue with exe's. Older conventional app's it works fine.
Somewhere in my codebase is another icon script but, I'm positive it's just for standard shell icons. It's obviously not simple because even a regular DX container doesn't get all the icons.
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Saturday, April 26, 2008 1:13 PM
If you post the script I can help you convert it over.