拖动和下降Automator动作到AMWorkflowView

拖动和下降Automator动作到AMWorkflowView

问题描述:

2010年,有人提起了错误: http://www.openradar.me/7582817拖动和下降Automator动作到AMWorkflowView

事实上,如果您拖动和拖放从Finder中的Automator的行动,可编辑AMWorkflowView,它不添加操作,但添加了一个新的“获取指定的查找器项目”操作。

我碰巧有一个NSTableView列出了一些可以从表视图拖动到其他视图的操作。在它的右边是一个AMWorkflowView,它应该是拖拽的目的地。一切都已实现并且工作正常,除了在这里,“获取指定的查找程序项”操作被添加,而不是被拖动的操作本身。

打印AMWorkflowView's-registeredDraggedtypes输出该列表:

[ “ApertureImageDataPboardType”, “CalUUIDPasteboardType”, “AlbumDataListPboardType”, “CorePasteboardFlavorType 0x6974756E”, “ABGroupsUIDsPboardType”, “CorePasteboardFlavorType 0x4F69646E”, “NSFilenamesPboardType “,”AutomatorActions“, ”com.apple.Automator.RunScript.source“,”Apple URL粘贴板类型“, ”com.apple.mail.PasteboardTypeAutomator“, ”ApertureFolderDataPboardType“,”NSStringPboardType“, “CorePasteboardFlavorType 0x4870666C”, “AutomatorVariables”, “ImageDataListPboardType”, “操作失误”, “ABPeopleUIDsPboardType”]

这似乎是 “AutomatorActions” pboard类型是相关的,但由于缺乏文件我一直无法弄清楚如何让我的应用程序工作。有没有关于这方面的有用信息?在Apple's Automator documentation中找不到任何有意义的内容...并且通过将AMBundleActionNSKeyedArchiver归档来设置NSPasteBoard的数据也无效。

+0

的Automator也加入 “获得指定的Finder项”。 – Willeke

没有记录,违法,使用您自己的风险:

- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes 
    toPasteboard:(NSPasteboard *)pboard 
{ 
    [pboard clearContents]; 
    NSMutableArray *array = [NSMutableArray array]; 
    for (AMAction *action in [[self.arrayController arrangedObjects] objectsAtIndexes:rowIndexes]) 
    { 
     NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; 
     [action writeToDictionary:dictionary]; 
     [array addObject:dictionary]; 
    } 
    if ([pboard setPropertyList:@{@"Actions":array} forType:@"AutomatorActions"]) 
     return YES; 
    return NO; 
} 
+0

工程很好,非常感谢。 –