Script Questions/Wishes

Wednesday, May 25, 2005 by MountainDragon | Discussion: DesktopX Development

I've been working on some DesktopX objects that involve quite a bit of scripting and I just ran into what could be a major problem for the current project (a drag and drop shortcut dockbar). Is it true that a shortcut type object doesn't expose the actual shortcut path to the script engine? The documentation for the object namespace doesn't mention this item.

This leaves me looking at having the script run the shortcut directly (not sure if that's possible either). Any help or suggestions would be greatly appreciated.

In addition, it would be real nice if the ActiveX controls would respond appropriately to tab keystroke when included in a parent object.

...
thomassen
Reply #1 Thursday, May 26, 2005 3:09 PM
To execute a command:

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run(strCommands)
Set WshShell = Nothing


Here, the strCommands is a variable with the path to the file you want to run, or any other command valid for the Run method.
You might want to do some error catching there with On Error Resume Next (Look it up in the documentation if you are not familiar with it.)
MountainDragon
Reply #2 Thursday, May 26, 2005 10:26 PM
Thomas, thanks for the suggestion. However, the .Exec method seems to be a better choice, since (at least in my system) the .Run method doesn't seem to be able to deal with paths that contain spaces. The .Exec funtion works as long as I dereference any shortcuts that are dropped. This is not bad since .CreateShortcut and then .TargetPath will give what I need.
thomassen
Reply #3 Friday, May 27, 2005 7:53 PM
Ah, for paths with spaces, use WshShell.Run(chr(34) & strCommands & chr(34))
That should append a quote infront and behind your command.
MountainDragon
Reply #4 Saturday, May 28, 2005 11:59 AM
Thanks again Thomas. I'm too spoiled by having worked in C and C++ for so long that I'm not used to dealing with so many unknowns about basic stuff

BTW, would you be interested in checking out the object I'm working on when I get it ready for testing?
thomassen
Reply #5 Sunday, May 29, 2005 8:07 AM
Sure, I can have a look. But I might be rather busy until wednesday as I have a project deadline comming up.

I'm too spoiled by having worked in C and C++

I wish I could do C. I've looked at it, but I've realised it'd something you have to invest a little bit more time in than, VB, JS and PHP. Though, at the moment I'm reading a book about C#.

The only reason why I knew that you'd have to append a quote character is that I'm currently working on a Console like widget. Had to find out how to the the Run method to work.
MountainDragon
Reply #6 Sunday, May 29, 2005 8:28 PM
Thomas, or anyone -
Is there anyway that you know of to get access to a program file's icon resource from within a DX script? I know I can do it for shortcut files, but I can't seem to find any reference to how to with the actual exe file. Since I don't have access to a shortcut object that gets dropped, I want to create my own image based shortcut (text based is easy) but I would like to be able to default the image to the current file icon.

Thanks
thomassen
Reply #7 Monday, May 30, 2005 9:55 AM
I've been thinking of making an object where I need to the same thing actually. I haven't tried, but I'll have a look when I've completed my project. I wonder if it can be loaded like windows does. Say if you want icon number 3 from the explorer.exe file you refer to it like this: "C:\windows\explorer.exe,3". Not sure if that'll work. Might have to use an ActiveX or COM control. I wonder if it's possible to use the Imagelist ocx control (from the Commom Control Library)... I've used that in VB applications, but I'm not sure if it can be used in DX scripting.
MountainDragon
Reply #8 Tuesday, May 31, 2005 10:55 AM
I found something that looks like it may work, but haven't had time yet to try it. Check it out: Link

He has a lot of interesting script stuff.

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!



web-wc01