Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534

    Lightbulb Group Project: The "Ex" Plugins

    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

    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
    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.
    Last edited by Centauri Soldier; 06-30-2009 at 04:10 PM.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  2. #2
    Join Date
    Apr 2009
    Posts
    277
    i see no reason to why this could not work, if someone is willing to take on the task then fine, although i think its a good idea, im not sure how AMS will respond to having different action tables in a single xml file, i know it can handle 2 or 3 sets of actions but that's as far as iv ever gone, also, wouldn't the action editor list just be too big.

    i guess users would (a=use the plugin, b=dont use the plugin), its still a worth while venture.

    MenuEx (not sure where this came from)
    Code:
    MenuEX={}
    
    local function AdjustSubMenuProperties(tSubMenu, tItemProperties)
    	for nIndex, tItem in tSubMenu do
    		if tItem.ID == tItemProperties.ID then			
    			for sKey, vValue in tItem do
    				if tItemProperties[sKey] == nil then
    					tItemProperties[sKey] = vValue;
    				end
    			end
    			tSubMenu[nIndex] = tItemProperties;
    			break;
    		elseif type(tItem.SubMenu) == 'table' and tItem.ID == -1 then
    			tSubMenu[nIndex].SubMenu = AdjustSubMenuProperties(tSubMenu[nIndex].SubMenu, tItemProperties);
    		end
    	end
    	return tSubMenu;
    end
    
    --
    function MenuEX.SetChecked(nID, bChecked)
        tMenu = Application.GetMenu();
        tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, Checked=bChecked});
        Application.SetMenu(tMenu);
    end
    
    function MenuEX.SetEnabled(nID, bEnabled)
        tMenu = Application.GetMenu();
        tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, Enabled=bEnabled});
        Application.SetMenu(tMenu);
    end
    
    function MenuEX.SetText(nID, sText)
        tMenu = Application.GetMenu();
        tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, Text=sText});
        Application.SetMenu(tMenu);
    end
    
    function MenuEX.SetIconID(nID, nIconID)
        tMenu = Application.GetMenu();
        tMenu = AdjustSubMenuProperties(tMenu, {ID=nID, IconID=nIconID});
        Application.SetMenu(tMenu);
    end
    TaskBarEX
    Code:
    TaskBarEX={}
    
    function TaskBarEX.GetSize()
    	local hTrayWnd = DLL.CallFunction(_SystemFolder.."\\User32.dll", "FindWindowA", "\"Shell_trayWnd\",\"\"", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
    	return Window.GetSize(hTrayWnd)
    end
    
    function TaskBarEX.GetPos()
    	local hTrayWnd = DLL.CallFunction(_SystemFolder.."\\User32.dll", "FindWindowA", "\"Shell_trayWnd\",\"\"", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
    	return Window.GetPos(hTrayWnd)
    end
    
    
    --Test
    --Dialog.Message("Notice", "Taskbar Size: "..GetTaskBarSize().Width.." x "..GetTaskBarSize().Height);
    --Dialog.Message("Notice", "Taskbar Pos: "..GetTaskBarPos().X.." x "..GetTaskBarPos().Y);
    ListBoxEX
    Code:
    ListBoxEX={}
    
    -- gets a listbox items data
    function ListBoxEX.GetItemData(sObject)
    	local tbSel = ListBox.GetSelected(sObject);
    	if tbSel then
    		return ListBox.GetItemData(sObject, tbSel[1]);
    	else
    		return ""
    	end
    end
    
    -- gets a listbox items text
    function ListBoxEX.GetItemText(sObject)
    	local tbSel = ListBox.GetSelected(sObject);
    	if tbSel then
    		return ListBox.GetItemText(sObject, tbSel[1]);
    	else
    		return ""
    	end
    end
    
    -- sets a listbox items data
    function ListBoxEX.SetItemData(sObject,sData)
    	local tbSel = ListBox.GetSelected(sObject);
    	if tbSel then
    		ListBox.SetItemData(sObject, tbSel[1], sData);
    		local err = Application.GetLastError();
    		if err == 0 then
    			return 0
    		else
    			return -1
    		end
    	else
    		return -1
    	end
    end
    
    -- sets a listbox items text
    function ListBoxEX.SetItemText(sObject,sText)
    	local tbSel = ListBox.GetSelected(sObject);
    	if tbSel then
    		ListBox.SetItemText(sObject, tbSel[1], sText);
    		local err = Application.GetLastError();
    		if err == 0 then
    			return 0;
    		else
    			return -1;
    		end
    	else
    		return -1;
    	end
    end
    
    -- returns a tabel of a listbox items
    function ListBoxEX.GetData(sObject)
    	local tbTmp={}
    	local nCount = ListBox.GetCount(sObject);
    	if nCount > 0 then
    		for i=1, nCount do
    			local nIndex = Table.Count(tbTmp) + 1;
    			Table.Insert(tbTmp, nIndex, {})
    			tbTmp[nIndex].Text = ListBox.GetItemText(sObject,i);
    			tbTmp[nIndex].Data = ListBox.GetItemData(sObject,i);
    		end
    		return tbTmp
    	end
    end
    
    -- returns a tabel of a listbox items
    function ListBoxEX.SetData(sObject,tbTable)
    	if Table.Count(tbTable) > 0 then
    		for i,k in tbTable do
    			ListBox.AddItem(sObject, tbTable[i].Text, tbTable[i].Data);
    		end
    	end
    end

    InputEX
    Code:
    InputEX={}
    
    function InputEX.SetWordWrap(sObject,bWrap)
    	Input.SetProperties(sObject,{HScrollbar = bWrap});
    	return Application.GetLastError();
    end
    
    function InputEX.GetWordWrap(sObject)
    	return Input.GetProperties(sObject).HScrollbar;
    end
    
    function InputEX.SaveToFile(sObject,sFile,bAppend)
    	local sText = Input.GetText(sObject);
    	TextFile.WriteFromString(sFile, sText, bAppend);
    	return Application.GetLastError();
    end
    
    function InputEX.LoadFromFile(sObject,sFile)
    	local sText = TextFile.ReadToString(sFile);
    	Input.SetText(sObject,sText);
    	return Application.GetLastError();
    end
    
    function InputEX.AlignText(sObject,cAlign)
    	Input.SetProperties(sObject,{Alignment = cAlign});
    	return Application.GetLastError();
    end
    
    function InputEX.SetFont(sObject,sFontName.nFontSize,bFontWeight,bFontItalic,bFontStrikeout,bFontUnderline,nFontColor)
    	local tbFont={}
    	tbFont.FontName=sFontName
    	tbFont.FontSize=nFontSize
    	tbFont.FontWeight=bFontWeight
    	tbFont.FontItalic=bFontItalic
    	tbFont.FontStrikeout=bFontStrikeout
    	tbFont.FontUnderline=bFontUnderline
    	tbFont.FontColor=nFontColor	
    	Input.SetProperties(sObject, tbFont);
    	return Application.GetLastError();
    end
    
    function InputEX.GetFont(sObject)
    	local tbFont=Input.GetProperties(sObject);
    	local tbRet={}
    	tbFont.FontName=tbRet.FontName
    	tbFont.FontSize=tbRet.FontSize
    	tbFont.FontWeight=tbRet.FontWeight
    	tbFont.FontItalic=tbRet.FontItalic
    	tbFont.FontStrikeout=tbRet.FontStrikeout
    	tbFont.FontUnderline=tbRet.FontUnderline
    	tbFont.FontColor=tbRet.FontColor	
    	return tbRet
    end
    SystemEX
    Code:
    SystemEX={}
    
    function SystemEX.ProcessIdleTasks(bWaitForReturn)
    	return File.Run(_SystemFolder.."\\rundll32.exe", "advapi32.dll,ProcessIdleTasks", "", SW_SHOWNORMAL, bWaitForReturn);
    
    
    
    end
    
    -- wow, need more functions

  3. #3
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Bad idea in my opinion. These joint venture projects never work. They have been tried over and over and nothing comes of them. Even if it was created, who would keep it updated when someone makes changes to their contribution. Plus it would be one big messy table.

    By the way there is already a ListBoxEx object plugin, so you are going to have to be very carefull. Lets not get carried away with this plugin compiler. Creating a plugin to clear the contents of a combobox is just crazy when I can do it with one simple action.

    This is bad:
    Code:
    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
    It should return true or false and not just exit script, that way you can decide what to do, like popup a message telling the user to select an item or what ever. The caller should decide what to do based on the outcome.

    Some of these are definitely useful, especially the Input and Taskbar ones. I think they should be kept as separate plugins named appropriately. That way people can use what they need. If you create a plugin, release it and let people decide if they want to use it or not.

    That's my opinion.
    Dermot

    I am so out of here

  4. #4
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    This is a great idea and I fully condone it, It will work.

    Quote Originally Posted by Dermot
    Creating a plugin to clear the contents of a combobox is just crazy when I can do it with one simple action.
    Go you, some of us can't.

    Quote Originally Posted by Dermot
    These joint venture projects never work. They have been tried over and over and nothing comes of them.
    What do you mean, People just posted above. Something came from it..

  5. #5
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Quote Originally Posted by ShadowUK View Post
    This is a great idea and I fully condone it, It will work.

    Go you, some of us can't.
    Code:
    ComboBox.ResetContent("YourComboBox")
    What do you mean, People just posted above. Something came from it..
    Talking about them is as far as they ever go, that's what I mean.
    Dermot

    I am so out of here

  6. #6
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Plus if people start creating some useful plugins, they can release them right away and people can start using them if they need them, instead of waiting for some monster plugin that contains everyones. People can pick and choose what they want. If someone updates their plugin, they can post the new version and people can download it. Instead of waiting for someone else to update the monster plugin with their changes. Then there is the issue of bugs and mistakes.
    Dermot

    I am so out of here

  7. #7
    Join Date
    Apr 2009
    Posts
    277
    you know, Dermot does have some very good points.

    either way i will make and release my own plugins.

  8. #8
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Dermot does have good points, nice thinking though guys
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  9. #9
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    Yes, Dermot does make some good points; However Dermot, I think you may have missed what I was trying to say. If we work together to make a single Ex plugin we can minimize the amount of Ex plugins out there and keep the confusion and clutter to a minimum. I am not suggesting that all Ex functions be ported to s single plugin, I am saying that it may be more convenient for all of us to combine our Ex functions into various Ex plugins. So now we would have ListBoxEx, ComboBoxEx, ApplicationEx etc. If someone did want a single plugin though we could make that too.

    As to your comments regarding my combobox code, I think that kind of input is excellent...don't look now but you were just contributing to the project by offering criticism of the code.

    Don't let the naysayers get you down folks, they don't mean anything by it...just keep posting and most of the work will be done. When we have enough for a complete Ex plugin, it gets compiled...easy peezy.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  10. #10
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by Centauri Soldier View Post
    Yes, Dermot does make some good points; However Dermot, I think you may have missed what I was trying to say. If we work together to make a single Ex plugin we can minimize the amount of Ex plugins out there and keep the confusion and clutter to a minimum. I am not suggesting that all Ex functions be ported to s single plugin, I am saying that it may be more convenient for all of us to combine our Ex functions into various Ex plugins. So now we would have ListBoxEx, ComboBoxEx, ApplicationEx etc. If someone did want a single plugin though we could make that too.

    As to your comments regarding my combobox code, I think that kind of input is excellent...don't look now but you were just contributing to the project by offering criticism of the code.

    Don't let the naysayers get you down folks, they don't mean anything by it...just keep posting and most of the work will be done. When we have enough for a complete Ex plugin, it gets compiled...easy peezy.
    Need a subversion repository? It would be an efficient way of getting new versions to people. I can set one up on svn.shadiku.com. :P

  11. #11
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    also, having to walk my way down through a bunch of actions I don't want to get to the needed action doesn't sound appealing.

    Does anyone else find it humorous that one of the complaints I hear most about AMS is that the EXE is too big, and here talking about making the mother of all plugins. Load what you need, leave the rest on the disk I say.

    my 2 pennies

  12. #12
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    That sounds good Shadow. I'm in.

    Quote Originally Posted by Worm View Post
    also, having to walk my way down through a bunch of actions I don't want to get to the needed action doesn't sound appealing.

    Does anyone else find it humorous that one of the complaints I hear most about AMS is that the EXE is too big, and here talking about making the mother of all plugins. Load what you need, leave the rest on the disk I say.

    my 2 pennies
    Please read below...

    Quote Originally Posted by Centauri Soldier View Post
    ...I am not suggesting that all Ex functions be ported to s single plugin, I am saying that it may be more convenient for all of us to combine our Ex functions into various Ex plugins. So now we would have ListBoxEx, ComboBoxEx, ApplicationEx etc...
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  13. #13
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by Worm View Post
    also, having to walk my way down through a bunch of actions I don't want to get to the needed action doesn't sound appealing.

    Does anyone else find it humorous that one of the complaints I hear most about AMS is that the EXE is too big, and here talking about making the mother of all plugins. Load what you need, leave the rest on the disk I say.

    my 2 pennies
    I actually agree with Worm here, why not share the sources and let people copypaste the functions they need? It's nice to have them as plugin for easy including the functions but I don't see much other benefits.
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  14. #14
    Join Date
    Apr 2009
    Posts
    277
    also, having to walk my way down through a bunch of actions I don't want to get to the needed action doesn't sound appealing.
    sounds a bit like the grid, lol

    ...I am not suggesting that all Ex functions be ported to s single plugin, I am saying that it may be more convenient for all of us to combine our Ex functions into various Ex plugins. So now we would have ListBoxEx, ComboBoxEx, ApplicationEx etc...
    so, you mean,(now correct me if im wrong here) i make say "InputEx" and you have a bunch of functions you think would improve "InputEx", so you post the functions and i add them to the plugin and re-release it ?

    if so, then that sounds more workable.

  15. #15
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    Quote Originally Posted by MicroByte View Post
    so, you mean,(now correct me if im wrong here) i make say "InputEx" and you have a bunch of functions you think would improve "InputEx", so you post the functions and i add them to the plugin and re-release it ?

    if so, then that sounds more workable.
    Exactly! That's all there is to it...
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts