First of all my Script is made to allow anybody to add his own picture to backgrounds available in my Skin "Avalon Concept 2009"
I use the following code to browse for a file: (come from the script "Backround Adder" and used with authorisation)
code:
function OnBackgroundWndenEvent_CtrlClicked(pPlusWnd, sControlId) {
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var sourceFile = pPlusWnd.GetControlText('EdtFrom').replace(/(^\s*)|(\s*$)/g, '');
switch (sControlId) {
case 'BtnLoc':
var oOpenDlg = new ActiveXObject('UserAccounts.CommonDialog');
oOpenDlg.FileName = sourceFile;
oOpenDlg.Filter = 'All Pictures|*.BMP;*.DIB;*.EMF;*.GIF;*.ICO;*.JPG;*.JPEG;*.JPE;*.JFIF;*.JIF;*.PNG;*.RLE;*.TIF;*.TIFF;*.WMF;|'
+ 'All Files (*.*)|*.*|'
+ 'Bitmaps (*.BMP)|*.BMP|'
+ 'JPEG (*.JPG;*.JPEG)|*.JPG;*.JPEG|'
+ 'Portable Network Graphics (*.PNG)|*.PNG|';
oOpenDlg.FilterIndex = (oOpenDlg.FileName === '' || oOpenDlg.Filter.indexOf("." + FSO.GetExtensionName(oOpenDlg.FileName).toUpperCase() + ';') !== -1) ? 1 : 2;
oOpenDlg.Flags = 0x1000 | 0x800 | 0x4;
oOpenDlg.ShowOpen();
pPlusWnd.SetControlText('EdtFrom', (oOpenDlg.FileName === '') ? '' : FSO.GetAbsolutePathName(oOpenDlg.FileName));
break;
case 'BtnOk':
AddBackground(sourceFile);
pPlusWnd.Close(1);
break;
case 'BtnAbout':
MsgPlus.CreateWnd('BackgroundAdder.xml', 'AboutWnden');
pPlusWnd.Close(1);
break;
}
}
but it works only on XP not on vista, could someone please help me?
Thanks