Revision: 22632
          http://sourceforge.net/p/bibdesk/svn/22632
Author:   hofman
Date:     2018-09-18 16:06:19 +0000 (Tue, 18 Sep 2018)
Log Message:
-----------
return added items from add script command

Modified Paths:
--------------
    trunk/bibdesk/BDSKAddCommand.m
    trunk/bibdesk/Scripting/BibDesk.sdef

Modified: trunk/bibdesk/BDSKAddCommand.m
===================================================================
--- trunk/bibdesk/BDSKAddCommand.m      2018-09-18 15:13:37 UTC (rev 22631)
+++ trunk/bibdesk/BDSKAddCommand.m      2018-09-18 16:06:19 UTC (rev 22632)
@@ -51,6 +51,7 @@
     id directParameter = [self directParameter];
     // for "any" type, directParameter is an NSAppleEventDescriptor and 
evaulatedReceiver is nil
     NSArray *insertionObjects = [directParameter objCObjectValue];
+    BOOL isArray = NO;
     
     // evaluate object specifiers
     if ([insertionObjects 
respondsToSelector:@selector(objectsByEvaluatingSpecifier)] ||
@@ -61,6 +62,8 @@
             insertionObjects = nil;
     }
     
+    isArray = [insertionObjects isKindOfClass:[NSArray class]];
+    
     if (insertionObjects == nil) {
         [self setScriptErrorNumber:NSArgumentsWrongScriptError];
         [self setScriptErrorString:NSLocalizedString(@"Invalid or missing 
objects to add", @"Error description")];
@@ -136,6 +139,11 @@
                     }
                 }
             }
+            
+            // get the return value as an NSAppleEventDescriptor
+            return [(isArray ? insertionObjects : [insertionObjects 
firstObject]) aeDescriptorValue];
+        } else {
+            return [NSAppleEventDescriptor listDescriptor];
         }
     }
     return nil;

Modified: trunk/bibdesk/Scripting/BibDesk.sdef
===================================================================
--- trunk/bibdesk/Scripting/BibDesk.sdef        2018-09-18 15:13:37 UTC (rev 
22631)
+++ trunk/bibdesk/Scripting/BibDesk.sdef        2018-09-18 16:06:19 UTC (rev 
22632)
@@ -450,6 +450,7 @@
                 <type type="specifier"/>
                 <type type="location specifier"/>
             </parameter>
+            <result type="any" description="the added items"/>
         </command>
         
         <command name="remove" code="BDSKRemv"

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to