Now that reteset has released his plugin creator I'm sure we all have code itching to be compiled into plugins.
This topic is specifically regarding all of our Ex addition to AMS. ListBoxEx, ParagraphEx etc. It is likely that many of us have developed many different additional function for the standard objects and will share them with others. Since these Ex scripts are so common I thought it might be good for us all (who have made any Ex scripts) to post them here and when we have everyone's scripts, a few of us can edit and compile all of them (the useful bits) into one Ex plugin for each object represented instead of us each releasing our own Ex plugin version. I have a TeamSpeak server if, at the end, the compilers need to communicate.
ComboBoxEx
Code:ComboBoxEx = {}; function ComboBoxEx.Clear(AFcombobox) for AFx = 1, ComboBox.GetCount(AFcombobox) do ComboBox.DeleteItem(AFcombobox, 1); end end function ComboBoxEx.EnsureSelection(AFcomboboxobject) --ensure an item is selected...if not exit the script local itemselected = ComboBox.GetSelected(AFcomboboxobject); --if no item is selected then exit the current script if itemselected == nil then Application.ExitScript(); end --end function end function ComboBoxEx.GetSelectedItemText(AFcomboboxobject) --get the selected listbox item local AFitemindex = ComboBox.GetSelected(AFcomboboxobject); --ensure an item has been selected if AFitemindex ~= nil then --get the text associated with the selected item AFnewitemdata = ComboBox.GetItemData(AFcomboboxobject, AFitemindex); return AFnewitemdata; end --end function end function ComboBoxEx.GetSelectedItemText(AFcomboboxobject) --get the selected listbox item local AFitemindex = ComboBox.GetSelected(AFcomboboxobject); --ensure an item has been selected if AFitemindex ~= nil then --get the text associated with the selected item AFnewitemtext = ComboBox.GetItemText(AFcomboboxobject, AFitemindex); return AFnewitemtext; end --end function end
FolderEx
Well that's a sample of some of the code I have built as well as some code I've got from some other people on the forums. If this idea works out I'll post the rest of mine.Code:FolderEx = {}; --======================>>>>>>>>>>>>>>>>>>>>>> function FolderEx.Clear(sAFFolderName) --[[>> << >> << >> <<<<<<<<<<<<<<<<<<<<<=====================--]] Folder.DeleteTree(sAFFolderName, nil); Folder.Create(sAFFolderName); -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> end--|||||||||||||END FUNCTION||||||||||||||||| -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> --THIS IS SOMEONE ELSE'S CODE --======================>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> function FolderEx.Copy(sSource, sDestination, bShowStatus) --[[>> << >> << >> <<<<<<<<<<<<<<<<<<<<<===============================================--]] --Enter global declarations and functions here... local m_sFolder; local m_FoundFolder; local error; --Find all the folders and sub-Folders --results are stored in the table m_tblFolders m_tblFolders = Folder.Find(sSource, "*", true, nil); --if our destination folder does not have the --backslash as the last character, add it if String.Right(sDestination, 1) ~= "\\" then sDestination = sDestination .. "\\"; end --m_tblFolders will be nil if there are no folders if m_tblFolders ~= nil then --enumerate through the found folders for n, m_FoundFolder in m_tblFolders do --replace the source's path with the destination's path m_sFolder = String.Replace(m_FoundFolder, sSource, sDestination, false); --create the folder Folder.Create(m_sFolder); error = Application.GetLastError(); if (error ~= 0) then --set n to value to exit FOR loop n = Table.Count(m_tblFolders) end end end --if no errors occurred, copy the files if (error == 0) then if bShowStatus == true then --show the status dialog StatusDlg.Show(MB_ICONNONE, false); end --copy all files from the source folder, with recurse. File.Copy(sSource .. "\\*.*", sDestination, true, true, false, true, nil); if bShowStatus == true then --hide the status dialog StatusDlg.Hide(); end error = Application.GetLastError(); end --clean up m_tblFolders = nil; return error; -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> end--|||||||||||||END FUNCTION||||||||||||||||| -->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> --by RizlaUK function FolderEx.GetParent(strPath) local sRet="" if Folder.DoesExist(strPath) then local sBase=String.Mid(strPath, String.ReverseFind(strPath, "\\") + 1, -1); local sParent = String.Replace(strPath, "\\"..sBase, "", false); sRet=sParent end return sRet end

Reply With Quote
