sViz sViz

DX Coders, lend me your ears!

DX Coders, lend me your ears!

Hi, guys. I'm working on a widget that is like a code snipper(?). It allows you to compile all the snippets of code you frequently use into a list. When you l-click on an item in that list say "OnScriptEnter" it'll automatically copy the code:

Sub Object_OnScriptEnter

End Sub

into system clipboard. So you basically click and paste. I'm always opening up multiple text files where I keep my scripts (or even opening up web pages) and highlighting, copying, pasting, and I thought it would be easier and less cluttered to have a convenient place to grab them from. At the moment all the information in the lists are formatted (rss style) and written to a text file in Local Settings > Temp. I will ultimately make it attached to the widget in the object directory. I can also add codes in the textfile itself and when I load up the widget the list will be compiled with the additional changes, creating a text object for each new item.

Here's where I need your input. There will be three lists. A custom list where you put the ones you've constructed, a standard list with all the basic DX sub procedures and funtions, and a resource list where you put links to tutorials on the web or a file on your computer.
I've already compiled as many codes as I can think of for the DX standard list but can you guys tell me if I've left any out? Also, what DX/scripting resources on the web do you think should be included with the widget?

Please look over the lists and let me know what I should add.

Here's the DX standard list:

OnScriptEnter
OnScriptExit
OnStateChange (can easily be modified to OnStateChanged)
OnMouseEnter
OnMouseLeave
OnShow
OnMove
OnSize
OnDropFiles
OnDrag
OnDragFinish
OnSetFocus
OnKillFocus
OnChar
OnKeyDown
OnLButtonDown
OnRButtonDown
OnLButtonUp
OnRButtonUp
OnLButtonUpEx
OnRButtonUpEx
OnScreenChange
OnWorkAreaChange
Pop Up Menu
DesktopX Form
Font Form (One setup specifically for font options and how to apply them to text objects. Will be asking Vad_M for permission.)
Dialog Box- files (for browsing)
Dialog Box- folders (for browsing)
Widget Preferences (including OnPreferencesChange)
For each elem (just as an enumeration example)
Select Case (I use this alot)

I didn't include any for the ActiveX controls as most come with script wizards but let me know if there are any you feel should be included.

Here's the resource list so far:

DX User's Guide online
DX tutorials on WC
Wincustomize DX forums
Stardock DX forums
Wincustomize
W3Schools VBScript Reference
MSDN VBScript Reference

Thanks.
12,561 views 63 replies
Reply #26 Top
Thanks for your kind words, rabidrobot. It really is this wonderful community that inspires me and encourages me to give back where I can because of all the help I've recieved (from everyone in this thread and many others).


I tweaked something in the writing to file process which screwed up the format in the file. All the codes were lost. I've got some backups which weren't totally up to date so I'll be working my way up with those.


It's almost time to release the widget for testing-- not today though(thanks to the unwelcome setback. I also still haven't done any graphics  ). If anyone would be interested in testing it out let me know and I'll send you a download link via PM once it's ready.

Suggestions for codes and resources are still welcome.



This has been the daily BUMP.

Reply #27 Top
You all know what a hack I am at DX but I'd be honored to test whatever you put together.  Thanks for doing this.
Reply #28 Top
I think I'm going to post a couple simple examples (input/message boxes) of using the include script in the DesktopX forums. Of course you're more than welcome to use anything I've posted.

For WMI, there is a very handy tool called Scriptomatic. Check it out for examples of how to access anything WMI has to offer.


That's a good suggestion but, I prefer the WMI Code Creator. Get it Here Script Center: Scripting Tools and Utilities
Reply #29 Top
Thanks Zubaz.
Reply #30 Top
I tried using external scripts for a "functions" library, doesn't work.

When you run the object.SetScript("script") it stops all further script processing in the object, and the only script to run in from the "Script" file.


I tried using external scripts for a "functions" library, doesn't work.

When you run the object.SetScript("script") it stops all further script processing in the object, and the only script to run in from the "Script" file.


if you are using JavaScript, you can load external files and add them to your executing script. I'm currently working on a project where I have a set of objects which all have similar functions, but some of them differ slightly. I have created a file for each module and include the modules as required.
Problem is that it's very hard to debug any errors occuring in included scriptas it'd return Error on line 0. So you have to make very good error trappings to handle it. (which is a good practice anyways)

An example would be:
Code: javascript
  1. var exScript = System.SimpleRead('externalscript.js');
  2. eval(exScript);


For VB script you have to do it differently. Check out the DX Wiki for a VB example Justin posted.
Reply #31 Top
I don't think external files are compiled into the gadget.

Only if they are included in the Custom Files list of an object.
Reply #32 Top
Ah. I see that the question on how to include external script files was answered. Didn't notice it when I scimmed through the page before I replied.

I do like the idea that it can read all my functions into the object, but i think using the method i talked about before where you have a single object with all your functions in it, and then call them from that object. It gets compiled with the widget/gadget making external scripts not needed to be ZIPPED into the EXE.

Problem with having one object to contain global functions is that if you need to use these functions from another object as the widget or desktop is loaded the script might not be availible.

If you add the external files to your Custom Files they will be included as you compile it. But if you are worried about people seeing your code you need to encrypt it somehow before compiling.



I like this widget idea sViz. I was about to make one myself to accompany the Script Manual. But it'd be a while before it'd be done as I'm quite busy.
Reply #33 Top
also, I'd like to test it out. send it to thom DOT t AT online DOT no
Reply #34 Top
But if you are worried about people seeing your code you need to encrypt it somehow before compiling.


Here's maybe a temporary solution but, you end up with a bunch of external exe. It's a vbstoexe compiler. VBStoEXE
Reply #35 Top
Thanks alot Thomassen.

Still tweaking the scripts and adding some features, but I finally put the graphics together.

Here are some pics:





I wanted it to match the real DX Helper so I used some of their graphics. I'll be working on a different look just in case that's not allowed. As you can see the widget can be minimized. In the mini mode, clicking on the list buttons will make the lists appear as pop up menus and you can still click on an item to copy the code. To edit the lists you have to be in full mode.


Suggestions and volunteers are still welcome.



That's the BUMP of the day.



Reply #36 Top
I was about to make one myself to accompany the Script Manual.


Well, if we can have tons of clock and weather widgets in the gallery, I don't see why we can't have more than one DX code snipper. I already have and use your excellent Script Manual.
Reply #37 Top
I'll throw my name into the beta testing hat. RomanDA can atest to the fact that I'm a very annoying tester!

Reply #38 Top
I think the listitems are to big. will require too much scrolling.

How about a button that will sync the list with an online repository maintained by the community? I plan such a function with my Script Manual. You can see it allready beeing layed out in that you can edit the references.xml file in the programs directory.
Reply #39 Top
Hi guys. I've uploaded the widget to a file sharing site. Those who have volunteered should be getting a PM shortly with the download link.

Thomassen, I made the font size and gaps between items smaller as you suggested.

How about a button that will sync the list with an online repository maintained by the community?


I wouldn't know where to begin with that one; way out of my league. I guess that's something to look forward to with your code snipper.

You guys are welcome to have a look at the widget in DXBuilder and scrutinize my scripts (any suggestions on efficiency or general clean coding are welcome as I'm always ready to learn).

This zip includes the widget and a textfile with instructions.

Features to be aware of:
Click on the list buttons to change lists on display
L-click on item to copy code
R-click on item to edit (this brings up the editing box)

In editing box, click ok to save or 'X' to cancel and close the box.

In mini mode, click on the list button to pop up lists. L-click on items to copy code.





It's not too late to suggest a code or resource, or to volunteer.

Thanks everyone. That's the daily BUMP.

Reply #40 Top
This is really looking interesting.  
Reply #41 Top
Nicely done. My only immediate suggestion is either placing the helper file directly in the Application Folder or allowing the user to choose where to save it to. My reasoning is in order to prevent losses from crashes.

I'll try to do some simple FSO examples & send them your way in the next couple of days. Have been working on one to parse shortcut files using the CreateShortcut method to return the absolute path, app name, and icon. Hung up on problems with the icons. It's yours to include when it's done.
Reply #42 Top
I can help you out with a little snipped to make the code examples downloadable.

Does your widget generate javascript as well?
Reply #43 Top
I was thinking about this widget and the real trick is going to be in making the system dynamic enough to allow users to submit code, have it consumed somewhere and then push it to the widgets that have already been distributed.  That's where the value will really kick in.
Reply #44 Top
My only immediate suggestion is either placing the helper file directly in the Application Folder or allowing the user to choose where to save it to.


Ah, good point.....how do I do that? Specifically, how do I find the file and call it from wherever it is?

the real trick is going to be in making the system dynamic enough to allow users to submit code, have it consumed somewhere and then push it to the widgets that have already been distributed.


You guys have alot higher aspirations for this widget than I originally imagined. This is a great idea; one that is beyond my skill level. I wouldn't mind opening this up and working with others on the nuts and bolts of the widget as a community project.

I can help you out with a little snipped to make the code examples downloadable.

Does your widget generate javascript as well?


I'd be grateful to receive any help from you, Thomassen. I'm afraid I'll be very busy for most of today and won't have much free time. Do you think you could you apply the changes you're talking about to the widget and send it back to me so I can see what you mean?

Thanks again, for everyone's participation. I'll see you guys later.
Reply #45 Top
You guys have alot higher aspirations for this widget than I originally imagined.
And that is why RomanDA hates working with me. "This is brilliant David!  You know what else would be cool though? . . . "
Reply #46 Top
And that is why RomanDA hates working with me.


OHHHHH THATS why...

LOL.. Zu is right, things always start out "hey this would be cool" and end up "OMG THIS DAMN THING IS 3000 LINES OF CODE NOW!!!!" But thats how things become really great. Or we hope.

I wonder if it would be possible to pull code snippits from a wiki type page? or maybe i could make a web page on my CommercialGadets site where people could upload new code samples, etc. That would take some web design work, but it would also be pretty cool.
Reply #47 Top
I'd be grateful to receive any help from you, Thomassen. I'm afraid I'll be very busy for most of today and won't have much free time. Do you think you could you apply the changes you're talking about to the widget and send it back to me so I can see what you mean?


I'm a bit busy myself at the moment doing a website. I'm not in London either so I'm away from my main development machine. Might not have time until the weekend. Dunno when you plan to release it. But maybe it can be added to a later version. Get the basics working first?

What I think would be great if the community could get a small website powered by PHP (or similar) and a database so we can make an upload form where people submitt snippeds. Snippets would be reviewed and tested before approval and then added to the database. The widget could then be able to request an updated file from the online repository.
What do you lot think?

To that site I was thinking we could add project pages as well where people could create project. Set goals and criterias. Other people could then join and assign then self to a task. That way someone who is more into doing graphics can set up a project, and request a coder to do some coder. Or vise versa.
Reply #48 Top
I wonder if it would be possible to pull code snippits from a wiki type page? or maybe i could make a web page on my CommercialGadets site where people could upload new code samples, etc. That would take some web design work, but it would also be pretty cool


ah! again I dont fully read all the comments before O post. I see we're thinking something of the same here.
Reply #49 Top
Ah, good point.....how do I do that? Specifically, how do I find the file and call it from wherever it is?


This is what I did for my Script Manual:
A default settings file is packaged with the widget which makes it availible at runtime to the gadget from the CurrentTheme folder of the widget.
If there is no setting file in the same folder as the widget exe it will copy the default setting file from the CurrentTheme folder.
Reply #50 Top
maybe we should look at a new web site DXCoders? or something
were we could setup a site for these kinds of things, tutorials, code samples, etc.

I dont know how complicated this would get, maybe we could have a simple login/pw setup to allow people to add new code samples (not everyone, that could get messy).

I have the server to do this, the issue is bandwidth, and costs. It we just use it for code, it wouldnt be too bad, but a lot of exe's and graphics, etc could be a pain if the site gets a lot of traffic.


Just looked: DXCoders.com is taken
so is DXCoding.com
http://www.desktopxcoders.com/ is open.. who knows.

Just let me know if we want to do something like this.

If we want to test this out.. i can make a little DB and put some samples into it, then make a page to view the snippits from, just need to know the format you want to try out.

This wouldn't take me long at all. Let me know