args First, Second local mpDlgText, Result, Key, Number, i, Buttons1, Buttons2 local Path = "D:\Utils\TotalCmd\" local Target = Path ++ "_temp.bar" local Bars = Path ++ "*.bar" local mpDlgCaption = "Wrong Parameter" local mpIcon = "WARNING" if(file.isfolder(First)) do mpDlgText = "First bar is " ++ First ++ "\nIt must be a file rather than a folder" if(MiscPlugin.MessageBox(2, "&Quit", "&Pick file") == "&Quit") quit First = pickfile(file.listfiles(Bars, 0), "Pick First Bar File") if(not First) quit endif if(file.type(First) != "bar") do mpDlgText = "First bar is " ++ First ++ "\nIt should have the BAR extension." if(MiscPlugin.MessageBox(2, "&Continue", "&Pick file") == "&Pick file") do First = pickfile(file.listfiles(Bars, 0), "Pick First Bar File") if(not First) quit endif endif if(file.isfolder(Second)) do mpDlgText = "Second bar is " ++ Second ++ "\nIt must be a file rather than a folder" if(MiscPlugin.MessageBox(2, "&Quit", "&Pick file") == "&Quit") quit Second = pickfile(file.listfiles(Bars, 0), "Pick Second Bar File") if(not Second) quit endif if(file.type(Second) != "bar") do mpDlgText = "Second bar is " ++ Second ++ "\It should have the BAR extension." if(MiscPlugin.MessageBox(2, "&Continue", "&Pick file") == "&Pick file") do Second = pickfile(file.listfiles(Bars, 0), "Pick Second Bar File") if(not Second) quit endif endif @start mpDlgText = "Second bar " ++ Second ++ " will be appended to the First bar " ++ First mpDlgText = mpDlgText ++ "\n\n(Choose 'Exchange' to exchange First with Second)" mpDlgCaption = "Merge Bars" mpIcon = "INFORMATION" Result = MiscPlugin.MessageBox(1, "&Go!", "E&xchange", "&Cancel") if(Result == "&Cancel") do quit elseif(Result == "E&xchange") do mpDlgText = First First = Second Second = mpDlgText jump start endif osd.show("Ùàñ...", "INFINITE", "48", "Arial Cyr", "-1", "255 000 000") if(not file.copy(First, Target)) do mpDlgText = "Failure copying " ++ First ++ " to " ++ Result messagebox("ok error", mpDlgText, "FILE plugin error #1") quit endif Buttons1 = ini.get(First, "Buttonbar", "Buttoncount") if(ini_status != "OK") do messagebox("ok error", ini_status, "INI plugin error #1") quit endif Buttons2 = ini.get(Second, "Buttonbar", "Buttoncount") if(ini_status != "OK") do messagebox("ok error", ini_status, "INI plugin error #2") quit endif Result = ini.set(Target, "Buttonbar", "Buttoncount", Buttons1 + Buttons2) if(Result != "OK") do messagebox("ok error", Result, "INI plugin error #3") quit endif v = vec.createfromwords("button cmd param Bars menu iconic") if(v == 0) do messagebox("ok error", "Failure creating vector", "VEC plugin Error") quit endif for(i = 1; i <= Buttons2; i++) Number = i + Buttons1 for(j = 0; j <= 5; j++) Key = v[j] ++ i if(ini.check_exists(Second, "Buttonbar", Key) == 3) do mpDlgText = ini.get(Second, "Buttonbar", Key) Key = v[j] ++ Number Result = ini.set(Target, "Buttonbar", Key, mpDlgText) if(Result != "OK") do messagebox("ok error", Result, "INI plugin error #5") quit endif endif endfor endfor vec.destroy(v) vec.unload ini.unload osd.unload mpDlgText = "First bar " ++ First ++ " and Second bar " ++ Second mpDlgText = mpDlgText ++ "\nare successfully merged in " ++ Target mpDlgCaption = "Congratulations!" mpIcon = "QUESTION" mpDlgText = mpDlgText Result = MiscPlugin.MessageBox(1, "&Open Bar", "to &First", "to &Second", "&to...", "&Quit") if(Result == "&Open Bar") do runfile.LoadBar(Target) elseif(Result == "to &First") do Result = file.move(Target, First) if(not Result) do mpDlgText = "Failure renaming " ++ Target ++ " to " ++ First messagebox("ok error", mpDlgText, "FILE plugin error #2") quit endif elseif(Result == "to &Second") do Result = file.move(Target, Second) if(not Result) do mpDlgText = "Failure renaming " ++ Target ++ " to " ++ Second messagebox("ok error", mpDlgText, "FILE plugin error #3") quit endif elseif(Result == "&to...") do @NewName Key = inputcancel("New name for bar") Key = Path ++ Key ++ ".bar" if(not file.validpath(Key)) do mpDlgText = "File " ++ Key ++ " already exists! Overwrite?" if(messagebox("yesno warning", mpDlgText, "Warning") == 7) jump NewName endif if(not file.move(Target, Key)) do mpDlgText = "Failure renaming " ++ Target ++ " to " ++ Key messagebox("ok error", mpDlgText, "FILE plugin error #4") quit endif endif