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:
Code: vbscript
- 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.