<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
	xmlns:desktopx="http://www.desktopx.info/codefeed/">
	<channel>
		<title>News - www.desktopx.info</title>
		<link>http://www.desktopx.info/</link>
		<description>Helping DX Coders Create, Enhance &amp; Excel!</description>
		<language>en</language>
		<item>
			<title>reidenbach</title>
			<author> ()</author>
			<pubDate>Thu, 20 Nov 2008 12:11:41 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/reidenbach/</link>
			<guid>http://testsite.desktopx.info/tutorials/reidenbach/</guid>
			<description>reidenbach reidenbach [link=http://pidstudio.com/components/com_fish/resource-1633.html]reidenbach[/link] </description>
			<desktopx:code>reidenbach reidenbach [link=http://pidstudio.com/components/com_fish/resource-1633.html]reidenbach[/link] </desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/reidenbach/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>INI Read/Write/Update</title>
			<author> ()</author>
			<pubDate>Thu, 30 Oct 2008 13:50:20 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/ini-read-write-update/</link>
			<guid>http://testsite.desktopx.info/tutorials/ini-read-write-update/</guid>
			<description>This is a INI reader/writer/updater that uses some simple commands to make this work in ANY program.  Will write more later.

Put all of this into a TEXT Object (just to test it out).</description>
			<desktopx:code>Dim IniName, IniCnt, IniTitle(100), IniDetails(100)
Const ForWriting =2 : Const ForReading = 1 : Const ForAppending = 8 

'Called when the script is executed
Sub Object_OnScriptEnter
IniName = &quot;BoxxiWP.ini&quot; '---- INI FILE NAME

Object.Text = &quot;Ini Info: &quot; &amp; vbnewline
Call ReadINI()
For x = 1 To IniCnt
 Object.Text = object.text &amp; IniTitle(x) &amp; &quot;: &quot; &amp; IniDetails(x) &amp; vbnewline
Next

object.text = object.Text &amp;vbnewline&amp; &quot;Checking on Light:&quot; &amp;vbnewline &amp; ReadINIValue(&quot;Light_OnOff&quot;)
If ReadINIValue(&quot;Light_OnOff&quot;) = &quot;Off&quot; Then 
	Call SetINIValue(&quot;Light_onoff&quot;,&quot;On&quot;)
Else
	Call SetINIValue(&quot;Light_onoff&quot;,&quot;Off&quot;)
End If
object.text = object.Text &amp;vbnewline&amp; &quot;Checking on Light:&quot; &amp;vbnewline &amp; ReadINIValue(&quot;Light_OnOff&quot;)
x = ReadINIValue(&quot;SS_Interval&quot;)
p = x + 1000
object.text = object.Text &amp;vbnewline&amp; &quot;x/p: &quot; &amp; x &amp; &quot;/&quot; &amp; p
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit

End Sub

Function WriteBlankINI()
	'------------------ INI DEFAUTL VALUES HERE -----------------------
	IniCnt = 0
	IniCnt = IniCnt+ 1 : IniTitle(1) = &quot;Light_OnOff&quot; : IniDetails(1) = &quot;Off&quot;
	IniCnt = IniCnt+ 1 : IniTitle(2) = &quot;WP_Name&quot; 		: IniDetails(2) = &quot;Dark&quot;
	IniCnt = IniCnt+ 1 : IniTitle(3) = &quot;CPic_Name&quot; 	: IniDetails(3) = &quot;Lake.jpg&quot;
	IniCnt = IniCnt+ 1 : IniTitle(4) = &quot;SS_Folder&quot;	 	: IniDetails(4) = &quot;c:\&quot;
	IniCnt = IniCnt+ 1 : IniTitle(5) = &quot;SS_Interval&quot; : IniDetails(5) = 3000
	IniCnt = IniCnt+ 1 : IniTitle(6) = &quot;SS_OnOff&quot;		: IniDetails(6) = &quot;Off&quot;
	IniCnt = IniCnt+ 1 : IniTitle(7) = &quot;SS_CurPhoto&quot;	: IniDetails(7) = 1
		' The INI File is Stored in the Directory where the Program is run
	IniContents = &quot;&quot;
	For x = 1 To INICnt	
   IniContents = IniContents &amp; IniTitle(x) &amp; &quot;|&quot; &amp; IniDetails(x) &amp; vbnewline
	Next
	fn = desktopx.ExecutableDirectory &amp; IniName
	System.SimpleWrite fn, IniContents, 1
End Function


Function ReadINI()
	Call CheckForINI()
'	object.text = Object.text &amp; &quot;Reading:&quot; &amp; vbnewline
	fn = desktopx.ExecutableDirectory &amp; IniName
	TextList = System.SimpleRead(fn, 1)
  Lines = Split(TextList, Chr(10))
	IniCnt = 0
	For A = UBound(Lines) To LBound(Lines) Step -1
 		If Len(Lines(A)) &gt; 0 Then 
  		t = instr(Lines(A),&quot;|&quot;)
  		IniCnt = IniCnt + 1
  		IniTitle(IniCnt) = left(Lines(A),t-1)
  		IniDetails(IniCnt) = mid(Lines(A),t+1)
  		l = len(IniDetails(IniCnt))
  		IniDetails(IniCnt) = left(IniDetails(IniCnt),l-1)
  	  'object.Text = object.Text &amp; &quot;Title(&quot; &amp; IniCnt &amp; &quot;): [&quot; &amp; IniTitle(IniCnt) &amp; &quot;]&quot; &amp; vbnewline
  	  'object.Text = object.Text &amp; &quot;Item(&quot; &amp; IniCnt &amp; &quot;): [&quot; &amp; IniDetails(IniCnt) &amp; &quot;]&quot; &amp; vbnewline
  	End If
	Next
End Function

Function WriteINI()
	' The INI File is Stored in the Directory where the Program is run
	IniContents = &quot;&quot;
	For x = 1 To INICnt	
   IniContents = IniContents &amp; IniTitle(x) &amp; &quot;|&quot; &amp; IniDetails(x) &amp; vbnewline
	Next
	fn = desktopx.ExecutableDirectory &amp; IniName
	System.SimpleWrite fn, IniContents, 1
End Function

Function CheckForINI()
	fn = desktopx.ExecutableDirectory &amp; IniName
	Set filesys = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	temp = filesys.FileExists(fn)
	path = filesys.GetAbsolutePathName(fn)
	If Not filesys.FileExists(fn) Then
   	Call WriteBlankFile()
	End If
	
End Function

Function ReadINIValue(Item)
	ReadINIValue = &quot;&quot;
	For x = 1 To INICnt
		If UCase(IniTitle(x)) = UCase(Item) Then	temp = IniDetails(x)	 
	Next
	ReadINIValue = Temp
End Function

Function SetINIValue(Item,value)
	For x = 1 To INICnt
		If UCase(IniTitle(x)) = UCase(Item) Then	IniDetails(x) = Value
	Next
 Call WriteINI()
End Function</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/ini-read-write-update/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>Special Folders: Recycle Bin</title>
			<author>SirSmiley (Adam)</author>
			<pubDate>Sun, 01 Jun 2008 15:26:55 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/special-folders-recycle-bin/</link>
			<guid>http://testsite.desktopx.info/tutorials/special-folders-recycle-bin/</guid>
			<description>It creates a columnar list of your recycle bin contents. Eg. File Name, Size, Type, Date Deleted. You can easily add more items such as original location, etc.

Place this script in a Text Object then click it to generate the list.</description>
			<desktopx:code>Const MY_RECENT_DOCUMENTS = &amp;H8&amp;
Const RECYCLE_BIN = &amp;Ha&amp;
'Const MY_COMPUTER = &amp;H11&amp;
'Const NETHOOD = &amp;H13&amp;
Const DATE_DEL = 2
Const FILE_SIZE = 3
Const FILE_TYPE = 4

'Constants for size
Const inBYTE = 1
Const inKILO = 1024      ' 2^10
Const inMEGA = 1048576     ' 2^20
Const inGIGA = 1073741824    ' 2^30
Const inTERA = 1099511627776   ' 2^40
Const inPETA = 1.12589990684262E+15  ' 2^50
Const inEXA = 1.15292150460685E+18  ' 2^60
Const inZETTA = 1.18059162071741E+21 ' 2^70
Const inYOTTA = 1.20892581961463E+24 ' 2^80

Set objShell = CreateObject(&quot;Shell.Application&quot;)
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
	If Not dragged Then
		'Call CreateList
		Call BuildArray
	End If
End Function

Dim arrData( )
' Build MultiDimensional Array
Function BuildArray
	Set objFolder = objShell.Namespace(RECYCLE_BIN)
	Set objFolderItem = objFolder.Self	
	Set colItems = objFolder.Items
	objCount=colItems.Count
	intRows=objCount-1
	r=0	' Rows
	For Each objItem In colItems
		strName=objItem.Name
    strSize = objFolder.GetDetailsOf(objItem, FILE_SIZE)
    strType = objFolder.GetDetailsOf(objItem, FILE_TYPE)
    dtmDel = objFolder.GetDetailsOf(objItem, DATE_DEL)
    arrSize = Split(strSize, &quot; &quot;)
    intSize = CLng(arrSize(0))
    ReDim Preserve arrData(intRows,4)'rows,columns
     arrData(r,0)=strName
     arrData(r,1)=intSize
     arrData(r,2)=strType
     arrData(r,3)=dtmDel
     r=r+1
    'intSize=intSize*inKILO
    'intTotal=intTotal+intSize ' Running Total
   'Object.Text=Object.Text&amp;objItem.Name&amp;vbtab&amp;intSize&amp;vbtab&amp;strType&amp;vbtab&amp;dtmDel&amp;vbcrlf
	Next	
	object.text=&quot;&quot;
	Call DisplayData
End Function

Function FileSize(intSize)
	If intSize &lt; inKILO Then
		fSize = (intSize/inBYTE)
		FileSize = FormatNumber(fSize,,,,0) &amp; &quot; Bytes&quot;
	ElseIf intSize &lt; inMEGA Then
		fSize = (intSize/inKILO)
		FileSize = FormatNumber(fSize,,,,0) &amp; &quot; KB&quot;
	ElseIf intSize &lt; inGIGA Then
		fSize = (intSize/inMEGA)
		FileSize = FormatNumber(fSize,,,,0) &amp; &quot; MB&quot;
	ElseIf intSize &lt; inTERA Then
		fSize = (intSize/inGIGA)
		FileSize = FormatNumber(fSize,,,,0) &amp; &quot; GB&quot;
	End If 
End Function

'Called when the script is executed
Sub Object_OnScriptEnter
object.text=&quot;Click Here for ultimate sexyness!&quot;
End Sub

' Reads &amp; formats multidimensional array data
Sub DisplayData
	' Lame work around since VBScript has pathetic sort options
	arrColPos=Array(100,100,100,100)
	
	' Column Header
	Object.Text=&quot;File Name&quot;&amp;String(26,Chr(160))&amp;_
							&quot;File Size&quot;&amp;String(26,Chr(160))&amp;_
							&quot;File Type&quot;&amp;String(26,Chr(160))&amp;_
							&quot;Date Deleted&quot;&amp;String(23,Chr(160))&amp;_
							vbcrlf
	For r=0 To UBound(arrData)	' Rows Statement
		For c=0 To 4	' Nested Columns Statement
			If c = 1 Then
				intSize=FileSize(arrData(r, c)*inKILO)
				'intSize =arrData(r, c)*inKILO
				intTotal=intTotal+(arrData(r, c)*inKILO) ' Running Total
				strData=intSize	
			ElseIf c1 Then
				strData=arrData(r, c)
			End If
							' Count Characters
					lngColDim=Len(strData)
					lngTCol=35'arrColPos(c)
					iValue=lngTCol-lngColDim
					If lngColDim</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/special-folders-recycle-bin/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>Hue Setting button code</title>
			<author>romanda (David Roman)</author>
			<pubDate>Wed, 21 May 2008 11:14:15 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/hue-setting-button-code/</link>
			<guid>http://testsite.desktopx.info/tutorials/hue-setting-button-code/</guid>
			<description>Add the following code to the object that you want to assign a HUE shift of +10 on each click.

In this example change the object names to ones from your project.
These are just used as an example

You can change the +10 to +5 if you want it to move slower up the HUE scale.</description>
			<desktopx:code>

Sub Object_OnLButtonDown(x, y)
Dim ulHue
ulHue = DesktopX.Object(&quot;3Dmetal_Clock_Face&quot;).hue
ulHue = ulHue + 10
'if hue is set to Black &quot;1000&quot; then set it back to Unshifted &quot;0&quot;
If ulHue &gt; 1001 Then ulHue = 0
If ulHue &gt; 255 And ulHue &lt; 999 Then ulHue = 1000
Call SetHue(ulHue)
End Sub

'*************************************************************

'Resets the hue to 0 if right clicked
Sub Object_OnRButtonDown(x, y)
Call SetHue(1000)
End Sub


'Resets the hue to 0 if right clicked
Sub Object_OnScriptEnter
If Object.LocalStorage(&quot;Hue&quot;) = &quot;&quot; Then
ulHue = 1000
Else
ulHue = Object.LocalStorage(&quot;Hue&quot;)
End If
Call SetHue(ulHue)
End Sub



Function SetHue(huesetting)
DesktopX.Object(&quot;3Dmetal_Clock_Face&quot;).hue = huesetting
DesktopX.Object(&quot;3Dmetal_Clock_Hours&quot;).hue =huesetting
DesktopX.Object(&quot;3Dmetal_Clock_Minutes&quot;).hue = huesetting
DesktopX.Object(&quot;3Dmetal_Clock_Seconds&quot;).hue = huesetting
Object.LocalStorage(&quot;Hue&quot;) = huesetting
desktopx.Object(&quot;test&quot;).text = huesetting
End Function</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/hue-setting-button-code/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>Date Format Function</title>
			<author>SirSmiley (Adam)</author>
			<pubDate>Tue, 13 May 2008 13:39:58 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/date-format-function/</link>
			<guid>http://testsite.desktopx.info/tutorials/date-format-function/</guid>
			<description>Use this function to format a date text object. I've included an example of how to use/create a dynamic date submenu.</description>
			<desktopx:code>' Create a Text Object called objText and create a script for it.
' Paste this code in it.

Dim oText,iDateFormat
Set oText=DesktopX.Object(&quot;objText&quot;)

'Called when L-click is released
Function Object_OnLButtonUp(x, y, dragged)
	If not dragged then
		Call MyMenu
	End If
End Function

Dim arrDateFormats()
' Put's Date Formats into an array for a submenu
Function Array_DateFormats
For i=0 to 11
ReDim Preserve arrDateFormats(12)
	arrDateFormats(i)=FormatDate(Date,i)
Next
End Function

' This is the actual Date Formating Function
Function FormatDate(dtmNumericDate,intFormat)
' Use Current Date
dtmDay=DatePart(&quot;d&quot;,dtmNumericDate)
If dtmDay &lt; 10 Then dtmDay=&quot;0&quot;&amp;dtmDay
dtmMth=DatePart(&quot;m&quot;,dtmNumericDate)
If dtmMth &lt; 10 Then dtmMth=&quot;0&quot;&amp;dtmMth
dtmYr=DatePart(&quot;yyyy&quot;,dtmNumericDate)

' Select Date Format
Select Case intFormat
	' Little endian form (day, month, year)
	Case 0	' dd/mm/yyyy
		FormatDate=dtmDay&amp;&quot;/&quot;&amp;dtmMth&amp;&quot;/&quot;&amp;dtmYr
	Case 1 'dd/mm/yy
		FormatDate=dtmDay&amp;&quot;/&quot;&amp;dtmMth&amp;&quot;/&quot;&amp;Right(dtmYr,2)
	Case 2 ' 16 November 2003
		FormatDate=dtmDay&amp;&quot; &quot;&amp;MonthName(dtmMth,False)&amp;&quot; &quot;&amp;dtmYr
	Case 3 ' dd/mmm/yyyy 16 Nov 2003		
		FormatDate=dtmDay&amp;&quot;/&quot;&amp;MonthName(dtmMth,True)&amp;&quot;/&quot;&amp;dtmYr
	' Middle endian form(month, day, year)
	Case 4	' mm/dd/yyyy 11/16/2003 or 11-16-2003 or 11.16.2003
		FormatDate=dtmMth&amp;&quot;/&quot;&amp;dtmDay&amp;&quot;/&quot;&amp;dtmYr
	Case 5	' mm/dd/yy' 11.16.03
		FormatDate=dtmMth&amp;&quot;/&quot;&amp;dtmDay&amp;&quot;/&quot;&amp;Right(dtmYr,2)	
	Case 6	' November 16, 2003
		FormatDate=MonthName(dtmMth,False)&amp;&quot; &quot;&amp;dtmDay&amp;&quot;, &quot;&amp;dtmYr
	Case 7	'mmm d, yyyy Nov. 16, 2003
		FormatDate=MonthName(dtmMth,True)&amp;&quot; &quot;&amp;dtmDay&amp;&quot; , &quot;&amp;dtmYr
	' ISO 8601 (year, month, day)
	Case 8	'yyyy.mm.dd
		FormatDate=dtmYr&amp;&quot;.&quot;&amp;dtmMth&amp;&quot;.&quot;&amp;dtmDay
	Case 9	'yyyy-mm-dd
		FormatDate=dtmYr&amp;&quot;-&quot;&amp;dtmMth&amp;&quot;-&quot;&amp;dtmDay
	Case 10	'yyyy/mm/dd
		FormatDate=dtmYr&amp;&quot;/&quot;&amp;dtmMth&amp;&quot;/&quot;&amp;dtmDay		
	Case 11	'yyyymmdd
		FormatDate=dtmYr&amp;dtmMth&amp;dtmDay
End SelectiDateFormat
End Function

Sub Object_OnScriptEnter
oText.Text=Date ' Set's text object to today's date
Call  Array_DateFormats
End Sub

' Example of Date Format Submenu
Sub MyMenu
Dim mainmenu, datemenu, result
Set mainmenu = nothing
Set datemenu = nothing
     Set datemenu= DesktopX.CreatePopupMenu
		For x = 0 To UBound(arrDateFormats)-1
			datemenu.AppendMenu 0, 100+x, arrDateFormats(x)
		Next
Set mainmenu = DesktopX.CreatePopupMenu  
mainmenu.AppendMenu 0, 1, &quot;Menu Item A&quot;  
mainmenu.AppendMenu 0, 2, &quot;Menu Item B&quot;
mainmenu.AppendMenu &amp;H00000010, datemenu.MenuID, &quot;Format Date&quot; 
result = mainmenu.TrackPopupMenu(0, System.CursorX, System.CursorY)
Select Case result
Case 1
msgbox &quot;You Chose Menu Item A&quot;
Case 2
msgbox &quot;You Chose Menu Item B&quot;
Case Else
If result&gt;=100 And result</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/date-format-function/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>animFlipState</title>
			<author> ()</author>
			<pubDate>Wed, 07 May 2008 03:26:27 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/animflipstate/</link>
			<guid>http://testsite.desktopx.info/tutorials/animflipstate/</guid>
			<description>An 'flip' style animation for an object. Provide the name of one of the objects states to the funtion and the object will 'flip' from it's current state image to it's new state image.</description>
			<desktopx:code>Sub animStateFlip(objName,newStateName)
If DesktopX.IsObject(objName) = False then Exit Sub
Set obj = DesktopX.Object(objName) 
frames = 5
objLeftOriginal = obj.Left
objWidthOriginal = obj.Width
widthStep = objWidthOriginal/frames
For a = 1 to frames
newWidth = obj.Width - widthStep
obj.Width = newWidth
newLeft = obj.Left + widthStep/2
obj.Left = newLeft
Next
obj.Width = 0
obj.State = newStateName
For a = 1 to frames
newWidth = obj.Width + widthStep
obj.Width = newWidth
newLeft = obj.Left - widthStep/2
obj.Left = newLeft
Next
obj.Width = objWidthOriginal
obj.State = objLeftOriginal
End Sub
</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/animflipstate/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>Faux Drag and Drop Icons</title>
			<author>sViz (sViz)</author>
			<pubDate>Tue, 29 Apr 2008 18:15:43 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/faux-drag-and-drop-icons/</link>
			<guid>http://testsite.desktopx.info/tutorials/faux-drag-and-drop-icons/</guid>
			<description>This script creates drag and drop icons/shortcuts with auto grid capability, size options, and spacing options. It's a more functional alternative to the standard DX drag and drop icon shortcuts.</description>
			<desktopx:code>'===INSTRUCTIONS=====
'Create &quot;parent&quot; object, accept drag and drop

'Create &quot;temp_obj&quot;, parent=&quot;parent&quot;, child= yes...
'x/y = -50, set w/h, objecttype = shortcut...
'movement = locked
'===================

'Called when files are dropped onto object
Sub Object_OnDropFiles(files)
		object.SetTimer 1, 100
End Sub

Sub Object_OnTimer1
	object.KillTimer 1
	setIcon
End Sub

Sub setIcon
	On Error Resume Next
	Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	'Give real icon object name
	For Each elem In object.Children
		If elem.name = &quot;&quot; Then
			elem.name = &quot;truicon&quot; 
			Set truicon = DesktopX.Object(&quot;truicon&quot;)
		End If
	Next
	If DesktopX.IsObject(&quot;truicon&quot;) = True Then
		'Get number of faux icons
		icongrp = DesktopX.GroupObjects(&quot;icongrp&quot;).count
		'Set new faux icon name
		newicon = &quot;icon_&quot; &amp; icongrp + 1
		'Clone faux icon template
		Set tempobj = DesktopX.Object(&quot;temp_obj&quot;)
		tempobj.clone newicon, tempobj.left, tempobj.top
		'Set new faux icon information
		DesktopX.Object(newicon).parent = DesktopX.Object(&quot;p&quot;)
		DesktopX.Object(newicon).group = &quot;icongrp&quot;
		DesktopX.Object(newicon).picture = truicon.picture
		DesktopX.Object(newicon).command = truicon.command
		DesktopX.Object(newicon).tooltiptext = fso.getbasename(DesktopX.Object(newicon).command)
		'Delete real icon object
		truicon.delete
		'Get new faux icon count
		lastobj = DesktopX.GroupObjects(&quot;icongrp&quot;).count
		gap = 28 '--space between faux icons
		'Arrange faux icons on grid
		For x = 1 To lastobj
			If x = 1 Then
				DesktopX.Object(&quot;icon_&quot; &amp; x).move 10,10
			Else
				lastx = DesktopX.Object(&quot;icon_&quot; &amp; x-1).right + gap
				lasty = DesktopX.Object(&quot;icon_&quot; &amp; x-1).top
				If lastx =&gt; object.width - gap Then
					lastx = 10
					lasty = DesktopX.Object(&quot;icon_&quot; &amp; x-1).bottom + gap
				End If
				DesktopX.Object(&quot;icon_&quot; &amp; x).move lastx, lasty
			End If
		Next
		Set fso = nothing
		Set truicon = nothing
		Set tempobj = nothing
	Else
		msgbox &quot;Drag and drop not accepted; invalid file type.&quot;
	End If
End Sub</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/faux-drag-and-drop-icons/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>Get Hard Drive Info from WMI</title>
			<author> ()</author>
			<pubDate>Tue, 18 Dec 2007 14:29:07 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/get-hard-drive-info-from-wmi/</link>
			<guid>http://testsite.desktopx.info/tutorials/get-hard-drive-info-from-wmi/</guid>
			<description>This reads your hard drive info from WMI 
It DOES NOT read A: B: so that it will not give you the Floppy grinding issue!</description>
			<desktopx:code>AT TOP OF CODE:
Dim Drive_Count, Drive_TotalSpace(100), Drive_FreeSpace(100), Drive_UsedSpace(100)
Dim Drive_FileSystem(100), Drive_Description(100), Drive_Type(100)
Dim Drive_VolumeName(100),Dim Drive_Letter(100)

Sub GetDriveInfo()
	Drive_Count = 0
	Temp_Count = 0
	Set objWMIService = GetObject(&quot;winmgmts:\\.\root\cimv2&quot;)
	Set DriveInfo = objWMIService.ExecQuery (&quot;Select * from Win32_LogicalDisk Where drivetype &gt; 1&quot;)
	
	'Dim DriveList
	'DriveList = Array(&quot;C:&quot;,&quot;D:&quot;,&quot;E:&quot;,&quot;F:&quot;,&quot;G:&quot;,&quot;H:&quot;,&quot;I:&quot;,&quot;J:&quot;,&quot;K:&quot;,&quot;L:&quot;,&quot;M:&quot;,&quot;N:&quot;,&quot;O:&quot;,&quot;P:&quot;,&quot;Q:&quot;,&quot;R:&quot;,&quot;S:&quot;,&quot;T:&quot;,&quot;U:&quot;,&quot;V:&quot;,&quot;W:&quot;,&quot;X:&quot;,&quot;Y:&quot;,&quot;Z:&quot;)
	'For Each DriveLtr In DriveList
		'Set DriveInfo = objWMIService.ExecQuery (&quot;Select * from Win32_LogicalDisk Where DeviceID = '&quot; &amp; DriveLtr &amp; &quot;'&quot;)
  	For Each objDrive In DriveInfo 
	  	Temp_count = Temp_count + 1
  	'If Drive_Letter(Temp_count)  &quot;A&quot; Or Drive_Letter(Temp_count)  &quot;B&quot; Then
  		Drive_Count = Drive_Count + 1
  		Drive_Letter(Drive_Count) = objDrive.DeviceID
	  	Drive_Type(Drive_Count) = objDrive.drivetype
	  	Drive_TotalSpace(Drive_Count) = objDrive.Size
	  	If objDrive.Size &gt; 1 Then Drive_TotalSpace(Drive_Count) = FormatNumber((objDrive.Size/1048576),2)
	    Drive_FreeSpace(Drive_Count) = objDrive.FreeSpace
	  	If objDrive.FreeSpace &gt; 1 Then Drive_FreeSpace(Drive_Count) = FormatNumber((objDrive.FreeSpace/1048576),2)
	    Drive_UsedSpace(Drive_Count) = objDrive.Size - objDrive.FreeSpace
	  	If Drive_UsedSpace(Drive_Count) &gt; 1 Then Drive_UsedSpace(Drive_Count) = FormatNumber((Drive_UsedSpace(Drive_Count)/1048576),2)
	  	Drive_FileSystem(Drive_Count) = objDrive.FileSystem
	  	Drive_Description(Drive_Count) = objDrive.Description
	  	Drive_Type(Drive_Count) = objDrive.DriveType
	  	Drive_VolumeName(Drive_Count) = objDrive.VolumeName
	  'End If
  	Next
  'Next
End Sub


Need to add some DIMS to the main script for this to work.. add them later.</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/get-hard-drive-info-from-wmi/#comments</comments>
			<category>vbscript</category>
		</item>
		<item>
			<title>Event Handler</title>
			<author>romanda (David Roman)</author>
			<pubDate>Sat, 15 Dec 2007 13:06:31 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/event-handler/</link>
			<guid>http://testsite.desktopx.info/tutorials/event-handler/</guid>
			<description>Event Handler test.</description>
			<desktopx:code>var events = new eventsHandler();
 
function eventsHandler() {
	var eventList = new Array();
	eventList['Object_OnLButtonDown'] = new Array();
	eventList['Object_OnLButtonUp'] = new Array();

	this.addEventListener = function(strEvent, refFunction) {
		// Add event listener
		this.eventList[strEvent].push(refFunction);
	}
	
	this.trigger = function(strFunction) {
		// Trigger event
		for (event in this.eventList[strFunction]) {
			if (arguments.length &gt; 1) {
				args = array();
				for (var i = 1; i &lt; arguments.length; i++) {
					args.push(arguments[i]);
				}
				event.call(args);
			} else {
				event.call();
			}
		}
	}
}

// Catch events
function Object_OnLButtonDown(x, y) {
	events.trigger('Object_OnLButtonDown', x, y);
}
function Object_OnLButtonUp(x, y, d) {
	events.trigger('Object_OnLButtonUp', x, y, d);
}


/* ********** MODULE DEFINITION **********
 * Core module providing basic functionalities.
 * this module must allways be included first.
 * All modules must provide a module definition.
 */
var core_module = new module('core', '0.1.0');
registerModule(core_module);

/* ********** MODULE CODE BEGINS HERE ********** */

function foo() {
	MsgBox('Event! From Foo.');
}
function bar() {
	MsgBox('Event! From Bar.');
}
events.addEventListener('Object_OnLButtonUp', foo);
events.addEventListener('Object_OnLButtonUp', bar);</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/event-handler/#comments</comments>
			<category>jscript</category>
		</item>
		<item>
			<title>RGB2CMYK</title>
			<author>romanda (David Roman)</author>
			<pubDate>Sat, 15 Dec 2007 10:08:20 UTC</pubDate>
			<link>http://testsite.desktopx.info/tutorials/rgb2cmyk/</link>
			<guid>http://testsite.desktopx.info/tutorials/rgb2cmyk/</guid>
			<description>Converts RGB colour values to CMYK</description>
			<desktopx:code>'=== INFORMATION ==='
'Version 1.0.0
' # Author: Thomas Thomassen
' # Website: http://www.thomthom.net/
'                         http://thomthom.wincustomize.com/

'=== DESCRIPTION ==='
'This widget converts from and to RGB and CMYK.
'It does not include any colour profile in the
'conversion. It uses the easyRGB forumla.

'CMYK values = 0 ÷ 1
'RGB values = 0 ÷ 255

'=== RESOURCES ==='
'http://www.easyrgb.com/math.php
'http://www.adaptiveview.com/cw/doc5a.html


Option Explicit

'References
Dim txtRed, txtBlue, txtGreen
Dim txtCyan, txtMagenta, txtYellow, txtBlack

'General Variables
Dim Init, modeRGB2CMYK, modeCMYK2RGB

'Called when the script is executed
Sub Object_OnScriptEnter
    Set txtRed            = DesktopX.ScriptObject(&quot;txtRed&quot;).Textbox
    Set txtBlue            = DesktopX.ScriptObject(&quot;txtBlue&quot;).Textbox
    Set txtGreen        = DesktopX.ScriptObject(&quot;txtGreen&quot;).Textbox
    
    Set txtCyan            = DesktopX.ScriptObject(&quot;txtCyan&quot;).Textbox
    Set txtMagenta        = DesktopX.ScriptObject(&quot;txtMagenta&quot;).Textbox
    Set txtYellow        = DesktopX.ScriptObject(&quot;txtYellow&quot;).Textbox
    Set txtBlack        = DesktopX.ScriptObject(&quot;txtBlack&quot;).Textbox
    
    
    txtRed.MaxLength = 3
    txtBlue.MaxLength = 3
    txtGreen.MaxLength = 3
    
    txtCyan.MaxLength = 3
    txtMagenta.MaxLength = 3
    txtYellow.MaxLength = 3
    txtBlack.MaxLength = 3
    
    
    txtRed.Text = 0
    txtBlue.Text = 0
    txtGreen.Text = 0
    
    txtCyan.Text = 0
    txtMagenta.Text = 0
    txtYellow.Text = 0
    txtBlack.Text = 0
    
    'All textboxes are initiated
    Init = True
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
    Set txtRed            = nothing
    Set txtBlue            = nothing
    Set txtGreen        = nothing
    
    Set txtCyan            = nothing
    Set txtMagenta    = nothing
    Set txtYellow        = nothing
    Set txtBlack        = nothing
End Sub

Public Sub Changed(strTextbox)
    'Check if the textboxes are initiated. This is because when the textbox first
    'is loaded it will call this sub. But this sub checks the values of all the
    'textboxes. So when txtRed first is loaded it calls this sub, but txtGreen,
    'txtBlue, ... isn't referneced yet so it causes an error. It could also be
    'worked around by using &quot;On Error Resume Next&quot;
    'On Error Resume Next
    
    If Init Then
        Dim iR, iB, iG
        Dim iC, iM, iY, iK
        
        Select Case (strTextbox)
            Case &quot;txtRed&quot;, &quot;txtBlue&quot;, &quot;txtGreen&quot;
                'Don't do anything if we are editing CMYK to RGB
                If Not modeCMYK2RGB Then
                    'Ensure valid data
                    If txtRed.Text        = &quot;&quot; Then txtRed.Text        = 0
                    If txtGreen.Text    = &quot;&quot; Then txtGreen.Text    = 0
                    If txtBlue.Text        = &quot;&quot; Then txtBlue.Text    = 0
                    
                    If txtRed.Text        &lt; 0 Then txtRed.Text        = 0
                    If txtGreen.Text    &lt; 0 Then txtGreen.Text    = 0
                    If txtBlue.Text        &lt; 0 Then txtBlue.Text        = 0
                    
                    If txtRed.Text        &gt; 255    Then txtRed.Text        = 255
                    If txtGreen.Text    &gt; 255    Then txtGreen.Text    = 255
                    If txtBlue.Text        &gt; 255    Then txtBlue.Text        = 255
                    
                    'RGB2CMYK
                 modeRGB2CMYK = True
                 
                 If txtRed.Text = 0 And txtGreen.Text = 0 And txtBlue.Text = 0 Then
                     'If RGB is all 0 it will cause raise an error. This bypasses this issue
                     txtCyan.Text    = 0
                         txtMagenta.Text = 0
                         txtYellow.Text    = 0
                         txtBlack.Text        = 100
                         
                 Else
                 
                     iC = 1 - ( txtRed.Text        / 255 )
                     iM = 1 - ( txtGreen.Text    / 255 )
                     iY = 1 - ( txtBlue.Text        / 255 )
                     
                     iK = 1
                     If iK &gt; iC    Then iK = iC
                        If iK &gt; iM    Then iK = iM
                        If iK &gt; iY    Then iK = iY
                        
                        txtCyan.Text    = CInt( (iC - iK) / (1 - iK) * 100 )
                         txtMagenta.Text = CInt( (iM - iK) / (1 - iK) * 100 )
                         txtYellow.Text    = CInt( (iY - iK) / (1 - iK) * 100 )
                         txtBlack.Text        = CInt( iK * 100 )
                     
                     End If
                     
                     modeRGB2CMYK = False
                 End If
            Case &quot;txtCyan&quot;, &quot;txtMagenta&quot;, &quot;txtYellow&quot;, &quot;txtBlack&quot;
                'Don't do anything if we are editing RGB to CMYK
                If Not modeRGB2CMYK Then
                    'Ensure valid data
                    If txtCyan.Text            = &quot;&quot; Then txtCyan.Text        = 0
                    If txtMagenta.Text    = &quot;&quot; Then txtMagenta.Text    = 0
                    If txtYellow.Text        = &quot;&quot; Then txtYellow.Text    = 0
                    If txtBlack.Text        = &quot;&quot; Then txtBlack.Text        = 0
                    
                    If txtCyan.Text            &lt; 0 Then txtCyan.Text            = 0
                    If txtMagenta.Text    &lt; 0 Then txtMagenta.Text    = 0
                    If txtYellow.Text        &lt; 0 Then txtYellow.Text        = 0
                    If txtBlack.Text        &lt; 0 Then txtBlack.Text        = 0
                    
                    If txtCyan.Text            &gt; 100 Then txtCyan.Text            = 100
                    If txtMagenta.Text    &gt; 100 Then txtMagenta.Text    = 100
                    If txtYellow.Text        &gt; 100 Then txtYellow.Text        = 100
                    If txtBlack.Text        &gt; 100 Then txtBlack.Text        = 100
                    
                    'CMYK2RGB
                    modeCMYK2RGB = True
                    
                    'Where CMYK And CMY values = 0 ÷ 1
                    iC = txtCyan.Text            / 100
                    iM = txtMagenta.Text    / 100
                    iY = txtYellow.Text        / 100
                    iK = txtBlack.Text        / 100
                    
                    iC = ( iC    * ( 1 - iK ) + iK )
                    iM = ( iM    * ( 1 - iK ) + iK )
                    iY = ( iY    * ( 1 - iK ) + iK )
                    
                    'CMY values = 0 ÷ 1
                    'RGB values = 0 ÷ 255
                    
                    txtRed.Text        = CInt( (1 - iC) * 255 )
                    txtGreen.Text    = CInt( (1 - iM) * 255 )
                    txtBlue.Text    = CInt( (1 - iY) * 255 )
                    
                    modeCMYK2RGB = False
                End If
        End Select
    End If
End Sub

Public Sub Tab(strObjectName, boolBackwards)
    If boolBackwards Then
        Select Case (strObjectName)
            Case &quot;txtRed&quot;            txtBlack.SetFocus
            Case &quot;txtGreen&quot;        txtRed.SetFocus
            Case &quot;txtBlue&quot;        txtGreen.SetFocus
            
            Case &quot;txtCyan&quot;        txtBlue.SetFocus
            Case &quot;txtMagenta&quot;    txtCyan.SetFocus
            Case &quot;txtYellow&quot;    txtMagenta.SetFocus
            Case &quot;txtBlack&quot;        txtYellow.SetFocus
        End Select
    Else
        Select Case (strObjectName)
            Case &quot;txtRed&quot;            txtGreen.SetFocus
            Case &quot;txtGreen&quot;        txtBlue.SetFocus
            Case &quot;txtBlue&quot;        txtCyan.SetFocus
            
            Case &quot;txtCyan&quot;        txtMagenta.SetFocus
            Case &quot;txtMagenta&quot;    txtYellow.SetFocus
            Case &quot;txtYellow&quot;    txtBlack.SetFocus
            Case &quot;txtBlack&quot;        txtRed.SetFocus
        End Select
    End If
End Sub</desktopx:code>
			<comments>http://testsite.desktopx.info/snippets/rgb2cmyk/#comments</comments>
			<category>vbscript</category>
		</item>

	</channel>
</rss>
