Welcome, Sit down, and make yourself comfortable.
Published on January 17, 2008 By RomanDA In DesktopX

Hey all,

I'm sure most of you think i have given up on DX. Its been months since I posted anything on DX scripting, or creation. Just been working my butt of out-of-town for most of the past 4 months.
Actually I'm sitting in a hotel room right now.  Anyway, I was looking at something the other day and wondered how many little SIMPLE tricks are hidden in DX. I was talking to miksama the other day and he pointed sent me some cool things.

I wanted to share some things that not everyone might know about, or even use. If you know one of these and have been using it forever, goodie, show us something you think we dont know about. I want this it be an ongoing article with lots of user input.

These will require that you know at lease some basics of scripting in DX. If you don't you might want to do a simple Google search for DesktopX Tutorials, I hear SOMEONE spent a great deal of time on some.

Lets get this started with a few 1 liners.

PING:
You want to ping a web site and get the resulting time to site.

x = system.Ping("www.wincustomize.com")
object.text = x & " ms"

WALLPAPER:
Want to change your wallpaper?
This is the quick way to do it.

Option:
0 = use default wallpaper
1 = Center wallpaper
2 = Tile wallpaper
3 = Stretch wallpaper

'Examples:

System.SetWallpaper "C:\temp\wall1.bmp", 1
'Sets the wallpaper to the bmp above and the 1 makes it centered.

System.SetWallpaper Object.Directory & "wall1.jpg", 2
'Sets the wallpaper to wall1 in the directory where the dx object was created, and the 2 tiles it.

System.SetWallpaper "", 0 
'This will restore the original wallpaper.

CLIPBOARD:
Say you want to dump something from DX to the windows clipboard?
Its 1 line of code easy.
I believe this works only with TEXT, not images, but i could be wrong.

System.Clipboard = Object.text

VOLUME/MUTE:
Ok, want a fast way to set your volume to 10? or 90? or mute it completely?

system.Volume = 10
system.Volume = 90

'or mute it
system.mute

READ A FILE
Want to dump the contents of a file to a text string?
Only param=1 is currently supported.

txtLog = System.SimpleRead("C:\temp\file2read.txt", 1)

WRITE TO A FILE
Ok, this is simple, dump the contents of a string into a file.
Only param=1 is currently supported.

txtstring = "This is the text string, could have anything in here" & vbnewline & "even on a second line"
System.SimpleWrite "C:\temp\output.txt", txtstring, 1

These are just a few simple SYSTEM tricks. What do you have up your DX sleeve?


Comments (Page 2)
2 Pages1 2 
on Jan 23, 2008
umm... I believe you did somewhere (unless I stole it from Vad or Tiggz?) because that's what I used with the iReflector. Except for the If Statement which seems obvious now.
on Jan 24, 2008
im getting old bud.. i need to organize all my little code snippets somewhere.. hmmm might have an idea on that too.
on Mar 09, 2008
In popup or right click menus add an "&" symbol before a letter.
When the menu is called selecting that letter will execute the resulting menu item.
Code: vbscript
  1. mainmenu.AppendMenu 0, 1, "&item1"
  2. mainmenu.AppendMenu 0, 2, "i&tem2"
  3. mainmenu.AppendMenu 0, 3, "it&em3"
on Mar 09, 2008
Haven't gotten into DX yet but I'd like to in the near future. So just marking this to be able to find it easily.
on Mar 09, 2008
Ditto
2 Pages1 2