Widgets ok but not gadgets..
Tuesday, September 22, 2009 by Richard Mohler | Discussion: DesktopX
Does anybody know a way to get gadgets to save their settings(position/ second hand-showing..I made a few clocks and noticed that widgets work fine but when it comes to making gadgets they just don't work right.. sVis wrote me a couple of scripts for clocks. When they work right you can choose whether to show/hide second hand plus second hand has a bounceback to it... Default is not showing.. But when(as a gadget) I choose to show second hand and move to different part of screen it always goes back to the place where it first loaded with the second hand not showing(when restarted). But as a widget it saves settings just fine, when restarted. I guess I'll just make them widgets unless someone knows how to fix this.. Windows 7 64 bit....
Reply #3 Saturday, September 26, 2009 11:57 PM
i have noticed that gadgets i have used alway default back to original settings
but not to despair....
I'm sure that shortly one of those smart scripters like sViz will drop by.
Reply #4 Sunday, September 27, 2009 4:16 AM
I tried a few gadgets I made and the settings stick for me.
The only other thing I can think of for you to try is to create an INI file. So when the gadget closes, it saves its settings to an external file. On reload it will read the file and set itself up again.
Here's an example:
- Const ForReading = 1, ForWriting = 2, ForAppending = 8
- Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
- Dim filename : filename = "myobjectsettings.txt"
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- setup
- End Sub
- 'Called when the script is terminated
- Sub Object_OnScriptExit
- writeFile
- End Sub
- Function setup
- iData = readFile
- If iData <> "" Then
- iDataSettings = split(iData,vbcrlf)
- object.Left = iDataSettings(0) '--apply the first setting listed
- object.top = iDataSettings(1) '--second setting
- 'object.visible = iDataSettings(2) '--third setting
- End If
- End Function
- Sub writeFile
- textfile = DesktopX.ExecutableDirectory & "\" & filename
- Set f = fso.OpenTextFile(textfile, ForWriting, True)
- 'List settings to write to file
- xpos = object.Left
- ypos = object.Top
- 'othersetting = object.visible
- f.Write xpos & vbcrlf & ypos '& vbcrlf & othersetting
- f.Close
- End Sub
- Function readFile
- textfile = DesktopX.ExecutableDirectory & "\" & filename
- fileinfo = ""
- If fso.FileExists(textfile) Then
- Set f = fso.OpenTextFile(textfile, ForReading)
- fileinfo = f.readall
- f.Close
- Else
- writeFile
- End If
- readFile = fileinfo
- End Function
In the example above, you set "filename" to the name of your INI file. It will be saved in the ExecutableDirectory, i.e., wherever the gadget is launching from (you'll likely find it in the main DesktopX folder.) The "writeFile" function is where you would add any extra settings you want to save (see the examples commented out.) The "setup" function is where you would apply the settings in the order in which they were saved to file.
Reply #5 Wednesday, September 30, 2009 11:43 AM
Sorry didn't have thing checked that says, persist object status across reloads (position, size, etc) Everythings fine now, thanks..Thanks sVis & Bichur..& sVis what's your name anyway? Get tired of jusy saying sVis. Anyway I may try that on something else..Also these sliding drawer templates I downloaded when I thought I was downloading Summer weather 2(updated cache) are pretty neat.. Are you going to upload them or do a tutorial using them?, cause I might like to use them sometime but I don't want to use them if you've got plans for them in the future. I won't even condider using them unless you give the ok..
Reply #6 Wednesday, September 30, 2009 7:29 PM
Glad everything's working for you. The sliding drawer templates are free for anyone to use, found here -- https://www.wincustomize.com/skins.aspx?skinid=4492&libid=3
Eve
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, September 26, 2009 11:26 PM
Thanks for helping me out guys...