Lexua

Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору lorents Цитата: и вот мне надо загрузить все три значения в проект сразу, просто не удобно каждый параметр загружать отдельно, как это можно сделать? | Тут удобнее использовать Grid и делим строку вида Russian,D:\Документы,off Цитата: И еще одна просьба, можно пример динамически создаваемого меню? | В Global Functions Цитата: function GetSFXPath() strPath = ""; strArg = _CommandLineArgs[1]; if strArg then strPath = String.Right(strArg, String.Length(strArg) - 10); end if (String.Length(strPath) > 0) then tblPath = String.SplitPath(strPath); strPath = tblPath.Drive..tblPath.Folder; end return strPath; end SrcFldr = GetSFXPath() | В Preload Цитата: local testcount = 1; local tcount = String.ToNumber(INIFile.GetValue(SrcFldr.."my.ini", "info", "count")); tblmenu = Application.GetMenu(); tblmenu[4].SubMenu[1].SubMenu = {}; while testcount <= tcount do local tname = INIFile.GetValue(SrcFldr.."my.ini", "info", "name"..testcount); local testname = String.Replace(tname, "#", "v", false); local menuid = 4010 + testcount; tblmenu[4].SubMenu[1].SubMenu[testcount] = {}; tblmenu[4].SubMenu[1].SubMenu[testcount].ID = menuid; tblmenu[4].SubMenu[1].SubMenu[testcount].Text = testname; testcount = testcount + 1; end Application.SetMenu(tblmenu); | в OnMenu Цитата: if e_ID > 4010 and e_ID <= 4999 then local add_count = 1; local tcount = String.ToNumber(INIFile.GetValue(SrcFldr.."my.ini", "info", "count")); while add_count <= tcount do menuid = 4010 + add_count if e_ID == menuid then if System.Is64BitOS() then info = INIFile.GetValue(SrcFldr.."my.ini", "info", "path"..add_count.."_x64"); else info = INIFile.GetValue(SrcFldr.."my.ini", "info", "path"..add_count); end File.Run(SrcFldr..info, "", "", SW_SHOWNORMAL, true); end add_count = add_count + 1; end end | В my.ini Цитата: [info] count=2 name1=System Information View #4.05 path1=tools\Siv\Siv.exe path1_x64=Tools\Siv\SIV64X.exe name2=System Information for Windows #2010-02-10 path2=tools\Siw.exe path2_x64=tools\Siw.exe | Хотя можно в данном случае обойтись и без count несколько усовершенствовав код Цитата: if e_ID > 4010 and e_ID <= 4999 then local add_count = 1; local valtable = INIFile.GetValueNames(SrcFldr.."my.ini", "info"); local tcount = Table.Count(valtable) / 3; while add_count <= tcount do menuid = 4010 + add_count if e_ID == menuid then if System.Is64BitOS() then info = INIFile.GetValue(SrcFldr.."my.ini", "info", "path"..add_count.."_x64"); else info = INIFile.GetValue(SrcFldr.."my.ini", "info", "path"..add_count); end File.Run(SrcFldr..info, "", "", SW_SHOWNORMAL, true); end add_count = add_count + 1; end end | | Всего записей: 2849 | Зарегистр. 15-10-2002 | Отправлено: 08:22 12-03-2010 | Исправлено: Lexua, 09:03 12-03-2010 |
|