Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    1,285

    Determine if an object exists

    Hi!
    It's me again. I need an action that doesn't exist in AMS and I didn't saw anything can help me here.
    In AMS there is File/Folder.DoesExist; But i need to determine if an object exists in my AMS application and there is nothing in AMS to do this.

    Is there anyone can make an free action plugin for this ?
    Thank you

    p.s. The action I was thinking should be like this:
    Object.DoesExist(String OBJ_Type,String OBJ_Name);

  2. #2
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    Here ya go...

    This uses only the object name
    Code:
    function ObjectDoesExist(sSearchObject)
    local bRet = false;
    
    local tAllObjects = Page.EnumerateObjects();
    
    if tAllObjects then
    
    	for nIndex, sObject in tAllObjects do
    		
    		if sObject == sSearchObject then
    		bRet = true;
    		break;
    		end	
    	
    	end
    
    end
    
    return bRet
    end

    This uses the object type and name
    Code:
    function ObjectDoesExist(nObjectType, sSearchObject)
    local bRet = false;
    
    local tAllObjects = Page.EnumerateObjects();
    
    if tAllObjects then
    
    	for nIndex, sObject in tAllObjects do
    		
    		if Page.GetObjectType(sObject) == nObjectType and sObject == sSearchObject then
    		bRet = true;
    		break;
    		end	
    	
    	end
    
    end
    
    return bRet
    end
    Oh, and for future reference, object types are numbers not strings. You could actually use a number instead of OBJECT_PARAGRAPH. The numbers for each object type are listed in the _constants.xml file in your AMS Data folder and probably in the help file as well.
    Last edited by Centauri Soldier; 08-14-2009 at 03:42 PM.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  3. #3
    Join Date
    Feb 2009
    Posts
    1,285
    Thankyou Centauri Soldier! That is what I was looking for and I hope it will be useful also for other people.

    p.s. personally, I use the second function
    p.p.s. Do you think can this be another function to add to AMS in future versions ?

    Bye!

Posting Permissions

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