将 Automator 操作拖放到 AMWorkflowView
Drag-and-dropping Automator Actions to an AMWorkflowView
2010 年有人提交了一个错误:
http://www.openradar.me/7582817
实际上,如果您将自动操作从 Finder 拖放到 editable AMWorkflowView
,它不会添加该操作,但会添加一个新的 "Get specified finder items" 操作.
我碰巧有一个 NSTableView
列出了一些可以从 table 视图拖到其他视图的操作。在它的右边是一个 AMWorkflowView
应该是拖动的目的地。一切都已实施并且运行良好,除了这里也添加了 "Get specified finder items" 动作而不是拖动的动作本身。
打印 AMWorkflowView's
-registeredDraggedtypes
输出此列表:
["ApertureImageDataPboardType", "CalUUIDPasteboardType",
"AlbumDataListPboardType", "CorePasteboardFlavorType 0x6974756E",
"ABGroupsUIDsPboardType", "CorePasteboardFlavorType 0x4F69646E",
"NSFilenamesPboardType", "AutomatorActions",
"com.apple.Automator.RunScript.source", "Apple URL pasteboard type",
"com.apple.mail.PasteboardTypeAutomator",
"ApertureFolderDataPboardType", "NSStringPboardType",
"CorePasteboardFlavorType 0x4870666C", "AutomatorVariables",
"ImageDataListPboardType", "Action errors", "ABPeopleUIDsPboardType"]
似乎 "AutomatorActions" pboard 类型是相关的类型,但由于缺乏文档,我一直无法弄清楚如何让我的应用程序工作。有这方面的有用信息吗?无法在 Apple's Automator documentation 中找到任何有意义的内容...并且通过使用 NSKeyedArchiver
归档 AMBundleAction
来设置 NSPasteBoard
的数据也没有用。
没有记录,非法,使用风险自负:
- (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;
}
2010 年有人提交了一个错误: http://www.openradar.me/7582817
实际上,如果您将自动操作从 Finder 拖放到 editable AMWorkflowView
,它不会添加该操作,但会添加一个新的 "Get specified finder items" 操作.
我碰巧有一个 NSTableView
列出了一些可以从 table 视图拖到其他视图的操作。在它的右边是一个 AMWorkflowView
应该是拖动的目的地。一切都已实施并且运行良好,除了这里也添加了 "Get specified finder items" 动作而不是拖动的动作本身。
打印 AMWorkflowView's
-registeredDraggedtypes
输出此列表:
["ApertureImageDataPboardType", "CalUUIDPasteboardType", "AlbumDataListPboardType", "CorePasteboardFlavorType 0x6974756E", "ABGroupsUIDsPboardType", "CorePasteboardFlavorType 0x4F69646E", "NSFilenamesPboardType", "AutomatorActions", "com.apple.Automator.RunScript.source", "Apple URL pasteboard type", "com.apple.mail.PasteboardTypeAutomator", "ApertureFolderDataPboardType", "NSStringPboardType", "CorePasteboardFlavorType 0x4870666C", "AutomatorVariables", "ImageDataListPboardType", "Action errors", "ABPeopleUIDsPboardType"]
似乎 "AutomatorActions" pboard 类型是相关的类型,但由于缺乏文档,我一直无法弄清楚如何让我的应用程序工作。有这方面的有用信息吗?无法在 Apple's Automator documentation 中找到任何有意义的内容...并且通过使用 NSKeyedArchiver
归档 AMBundleAction
来设置 NSPasteBoard
的数据也没有用。
没有记录,非法,使用风险自负:
- (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;
}