whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
O.P. HELP - Arrays in the registry!
I want to use this with the Interface Writer script, but I have a problem with what it returns.
Note: this function uses a registry code snippet.
js code: function SaveProject()
{
Debug.Trace("<-- Start project save. -->");
try
{
Debug.Trace("> Attempting to save project to the registry...");
if (ExistsRegistry("Sys", "FilePath"))
{
if (Interop.Call('user32', 'MessageBoxW', objWnd.Handle, "A file already exists in the registry. Overwrite?", "Interface Writer | Save Project", 4 | 48) !== 7)
{
Debug.Trace("-> Saving system data to the registry...");
Debug.Trace("--> Saving file path...");
WriteRegistry("Sys", "FilePath", FilePath, true);
Debug.Trace("-> Saving window data to the registry...");
Debug.Trace("--> Saving window IDs...");
WriteRegistry("Lst", "Id", WndLstId, true);
Debug.Trace("--> Saving window titles...");
WriteRegistry("Lst", "Title", WndLstTitle, true);
Debug.Trace("--> Saving window widths...");
WriteRegistry("Lst", "Width", WndLstWidth, true);
Debug.Trace("--> Saving window heights...");
WriteRegistry("Lst", "Height", WndLstHeight, true);
Debug.Trace("--> Saving other window data...");
WriteRegistry("Lst", "Minimize", WndLstMinimize, true);
WriteRegistry("Lst", "Maximize", WndLstMaximize, true);
WriteRegistry("Lst", "Close", WndLstClose, true);
Debug.Trace("-> Saving control data to the registry...");
Debug.Trace("--> Saving control IDs...");
WriteRegistry("Ctrl", "Id", WndCtrlId, true);
Debug.Trace("--> Saving control types...");
WriteRegistry("Ctrl", "Type", WndCtrlType, true);
Debug.Trace("--> Saving control left positionings...");
WriteRegistry("Ctrl", "Left", WndCtrlLeft, true);
Debug.Trace("--> Saving control down positionings...");
WriteRegistry("Ctrl", "Down", WndCtrlDown, true);
Debug.Trace("--> Saving control widths...");
WriteRegistry("Ctrl", "Width", WndCtrlWidth, true);
Debug.Trace("--> Saving control heights...");
WriteRegistry("Ctrl", "Height", WndCtrlHeight, true);
Debug.Trace("--> Saving control captions...");
WriteRegistry("Ctrl", "Caption", WndCtrlCaption, true);
Debug.Trace("--> Saving control help texts...");
WriteRegistry("Ctrl", "Help", WndCtrlHelp, true);
}
}
else
{
Debug.Trace("-> Saving system data to the registry...");
Debug.Trace("--> Saving file path...");
WriteRegistry("Sys", "FilePath", FilePath, true);
Debug.Trace("-> Saving window data to the registry...");
Debug.Trace("--> Saving window IDs...");
WriteRegistry("Lst", "Id", WndLstId, true);
Debug.Trace("--> Saving window titles...");
WriteRegistry("Lst", "Title", WndLstTitle, true);
Debug.Trace("--> Saving window widths...");
WriteRegistry("Lst", "Width", WndLstWidth, true);
Debug.Trace("--> Saving window heights...");
WriteRegistry("Lst", "Height", WndLstHeight, true);
Debug.Trace("--> Saving other window data...");
WriteRegistry("Lst", "Minimize", WndLstMinimize, true);
WriteRegistry("Lst", "Maximize", WndLstMaximize, true);
WriteRegistry("Lst", "Close", WndLstClose, true);
Debug.Trace("-> Saving control data to the registry...");
Debug.Trace("--> Saving control IDs...");
WriteRegistry("Ctrl", "Id", WndCtrlId, true);
Debug.Trace("--> Saving control types...");
WriteRegistry("Ctrl", "Type", WndCtrlType, true);
Debug.Trace("--> Saving control left positionings...");
WriteRegistry("Ctrl", "Left", WndCtrlLeft, true);
Debug.Trace("--> Saving control down positionings...");
WriteRegistry("Ctrl", "Down", WndCtrlDown, true);
Debug.Trace("--> Saving control widths...");
WriteRegistry("Ctrl", "Width", WndCtrlWidth, true);
Debug.Trace("--> Saving control heights...");
WriteRegistry("Ctrl", "Height", WndCtrlHeight, true);
Debug.Trace("--> Saving control captions...");
WriteRegistry("Ctrl", "Caption", WndCtrlCaption, true);
Debug.Trace("--> Saving control help texts...");
WriteRegistry("Ctrl", "Help", WndCtrlHelp, true);
Debug.Trace("> Project save successful.");
}
Interop.Call('user32', 'MessageBoxW', WndWriterEditFile.Handle, "The interface project has been saved successfully.\nInterface Writer will now exit...", "Interface Writer | Save Project", 64);
}
catch (error)
{
Debug.Trace("> Project save error (" + error + ").");
Interop.Call('user32', 'MessageBoxW', WndWriterEditFile.Handle, "There was a problem whilst saving the project.\nError reported by script: " + error, "Interface Writer | Save Project", 64);
}
Debug.Trace("<-- End project save. -->");
}
function LoadProject()
{
Debug.Trace("<-- Start project load. -->");
try
{
Debug.Trace("> Attempting to load project from the registry...");
Debug.Trace("-> Loading system data to the registry...");
Debug.Trace("--> Loading file path...");
FilePath = ReadRegistry("Sys", "FilePath");
Debug.Trace("-> Loading window data to the registry...");
Debug.Trace("--> Loading window IDs...");
WndLstId = new Array(ReadRegistry("Lst", "Id"));
Debug.Trace("--> Loading window titles...");
WndLstTitle = new Array(ReadRegistry("Lst", "Title"));
Debug.Trace("--> Loading window widths...");
WndLstWidth = new Array(ReadRegistry("Lst", "Width"));
Debug.Trace("--> Loading window heights...");
WndLstHeight = new Array(ReadRegistry("Lst", "Height"));
Debug.Trace("--> Loading other window data...");
WndLstMinimize = new Array(ReadRegistry("Lst", "Minimize"));
WndLstMaximize = new Array(ReadRegistry("Lst", "Maximize"));
WndLstClose = new Array(ReadRegistry("Lst", "Close"));
Debug.Trace("-> Loading control data to the registry...");
Debug.Trace("--> Loading control IDs...");
WndCtrlId = new Array(ReadRegistry("Ctrl", "Id"));
Debug.Trace("--> Loading control types...");
WndCtrlType = new Array(ReadRegistry("Ctrl", "Type"));
Debug.Trace("--> Loading control left positionings...");
WndCtrlLeft = new Array(ReadRegistry("Ctrl", "Left"));
Debug.Trace("--> Loading control down positionings...");
WndCtrlDown = new Array(ReadRegistry("Ctrl", "Down"));
Debug.Trace("--> Loading control widths...");
WndCtrlWidth = new Array(ReadRegistry("Ctrl", "Width"));
Debug.Trace("--> Loading control heights...");
WndCtrlHeight = new Array(ReadRegistry("Ctrl", "Height"));
Debug.Trace("--> Loading control captions...");
WndCtrlCaption = new Array(ReadRegistry("Ctrl", "Caption"));
Debug.Trace("--> Loading control help texts...");
WndCtrlHelp = new Array(ReadRegistry("Ctrl", "Help"));
Debug.Trace("-> Deleting system data from the registry...");
Debug.Trace("--> Deleting file path...");
DeleteRegistry("Sys", "FilePath");
Debug.Trace("-> Deleting window data to the registry...");
Debug.Trace("--> Deleting window IDs...");
DeleteRegistry("Lst", "Id");
Debug.Trace("--> Deleting window titles...");
DeleteRegistry("Lst", "Title");
Debug.Trace("--> Deleting window widths...");
DeleteRegistry("Lst", "Width");
Debug.Trace("--> Deleting window heights...");
DeleteRegistry("Lst", "Height");
Debug.Trace("--> Deleting other window data...");
DeleteRegistry("Lst", "Minimize");
DeleteRegistry("Lst", "Maximize");
DeleteRegistry("Lst", "Close");
Debug.Trace("-> Deleting control data to the registry...");
Debug.Trace("--> Deleting control IDs...");
DeleteRegistry("Ctrl", "Id");
Debug.Trace("--> Deleting control types...");
DeleteRegistry("Ctrl", "Type");
Debug.Trace("--> Deleting control left positionings...");
DeleteRegistry("Ctrl", "Left");
Debug.Trace("--> Deleting control down positionings...");
DeleteRegistry("Ctrl", "Down");
Debug.Trace("--> Deleting control widths...");
DeleteRegistry("Ctrl", "Width");
Debug.Trace("--> Deleting control heights...");
DeleteRegistry("Ctrl", "Height");
Debug.Trace("--> Deleting control captions...");
DeleteRegistry("Ctrl", "Caption");
Debug.Trace("--> Deleting control help texts...");
DeleteRegistry("Ctrl", "Help");
Debug.Trace("> Project loading successful.");
Interop.Call('user32', 'MessageBoxW', null, "The interface project has been loaded successfully.\nInterface Writer will now exit...", "Interface Writer | Save Project", 64);
OnWndWriterEditFileEvent_Build();
}
catch (error)
{
Debug.Trace("> Project load error (" + error + ").");
Interop.Call('user32', 'MessageBoxW', null, "There was a problem whilst loading the project.\nError reported by script: " + error, "Interface Writer | Save Project", 64);
}
Debug.Trace("<-- End project load. -->");
}
Let's say, for example, that I have two window IDs, "Wnd1" and "Wnd2". Instead of the registry returning "Wnd1" in "WndLstId[0]" and "Wnd2" in "WndLstId[1]", I get "Wnd1,Wnd2" in "WndLstId[0]". How can I get it so it splits items using the comma?
|
|