复制画板3.8之前
// MSCanvasActions
var action = doc.actionsController().actionWithName("MSCanvasActions");
// 默认复制artboards中最后一个画板
action.duplicate(nil);
artboards = page.artboards();
复制前,page里的Artboard数组
"<MSArtboardGroup: 0x7fc4a0f51660> 6 (40479CFB-8A05-4C93-9704-384F0345D865)",
"<MSArtboardGroup: 0x7fc4a0f51780> 6+ (F383BFC0-06BA-43F9-9858-2B16ACC4290B)"
复制后,
当选中"6"画板,复制,"6 copy"画板的在artboards数组中紧紧随"6"后:
"<MSArtboardGroup: 0x7fc4a0f51660> 6 (40479CFB-8A05-4C93-9704-384F0345D865)",
"<MSArtboardGroup: 0x7fc4a5a017d0> 6 copy (F2BB6C08-12FE-4C10-8F67-1A3E540B69C1)",
"<MSArtboardGroup: 0x7fc4a0f51780> 6+ (F383BFC0-06BA-43F9-9858-2B16ACC4290B)"
3.8.3之后
复制画板
doc = context.document;
log("controller :" + doc.actionsController);
var actionController = doc.actionsController();
log("actions :" + actionController.allActions());
action = actionController.actionWithID("MSCanvasActions");
action.duplicate(nil);
可以关注一下下面这些acrion, 支持很多功能。日后开发文档也可能会完善:
log("actions :" + actionController.allActions());
16/6/5 下午9:34:02.469 Scale (Sketch Plugin)[32254]: actions :(
"<MSInsertSliceAction: 0x7f94a700fab0>",
"<MSTogglePixelGridAction: 0x7f94a70174b0>",
"<MSAddFillAction: 0x7f94a7018700>",
"<MSAlignLayersCenterAction: 0x7f94a70085b0>",
"<MSZoomAction: 0x7f94a7003790>",
"<MSExportAction: 0x7f94a7017790>",
"<MSConvertToOutlinesAction: 0x7f94a70160a0>",
"<MSAlignCenterAction: 0x7f94a7010430>",
"<MSReplaceImageAction: 0x7f94a7014830>",
"<MSTriangleShapeAction: 0x7f94a700ffb0>",
"<MSRotateAction: 0x7f94a7015df0>",
"<MSLockLayerAction: 0x7f94a7017d40>",
"<MSFlipHorizontalAction: 0x7f94a70116c0>",
"<MSInsertImageAction: 0x7f94a700f790>",
"<MSHideLayerAction: 0x7f94a7017a60>",
"<MSAddShadowAction: 0x7f94a7009cd0>",
"<MSBackToInstanceAction: 0x7f94a701e7b0>",
"<MSUnderlineAction: 0x7f94a700fae0>",
"<MSInsertLineAction: 0x7f94a700ee60>",
"<MSAlignLeftAction: 0x7f94a7005870>",
"<MSSelectAllArtboardsAction: 0x7f94a701ed70>",
"<MSShowFillOptionsAction: 0x7f94a7015440>",
"<MSTogglePixelLinesAction: 0x7f94a701f8f0>",
"<MSToggleLayerHighlightAction: 0x7f94a701feb0>",
"<MSMoveToFrontAction: 0x7f94a7013f60>",
"<MSHideAllGridsAndLayoutsAction: 0x7f94a70138c0>",
"<MSImageOriginalSizeAction: 0x7f94a7007e30>",
"<MSAddInnerShadowAction: 0x7f94a70190f0>",
"<MSCloudAction: 0x7f94a701d8f0>",
"<MSStarShapeAction: 0x7f94a7011970>",
"<MSPencilAction: 0x7f94a700f180>",
"<MSIgnoreClippingMaskAction: 0x7f94a7006c40>",
"<MSInsertTextLayerAction: 0x7f94a700f430>",
"<MSAlignLayersMiddleAction: 0x7f94a7008a70>",
"<MSAddBorderAction: 0x7f94a70099c0>",
"<MSCreateSymbolAction: 0x7f94a7018b00>",
"<MSClippingMaskAction: 0x7f94a7012180>",
"<MSToggleGridAction: 0x7f94a7016ef0>",
"<MSViewMenuAction: 0x7f94a7016930>",
"<MSBooleanMenuAction: 0x7f94a7010030>",
"<MSDifferenceAction: 0x7f94a70135a0>",
"<MSReduceImageSizeAction: 0x7f94a70079c0>",
"<MSBaseAlignLayersAction: 0x7f94a70081d0>",
"<MSResizeArtboardToFitAction: 0x7f94a701e2b0>",
"<MSSpiralShapeAction: 0x7f94a7013940>",
"<MSToggleBorderAction: 0x7f94a7011250>",
"<MSToggleArtboardShadowAction: 0x7f94a701f330>",
"<MSUnionAction: 0x7f94a7012d10>",
"<MSRoundedRectangleShapeAction: 0x7f94a7010c70>",
"<MSOvalShapeAction: 0x7f94a700f960>",
"<MSCanvasActions: 0x7f94a391c760>",
"<MSNineSliceAction: 0x7f94a70150a0>",
"<MSToggleFillAction: 0x7f94a7013010>",
"<MSPolygonShapeAction: 0x7f94a7011690>",
"<MSSmartRotateAction: 0x7f94a7015860>",
"<MSEditAction: 0x7f94a7015b40>",
"<MSTransformAction: 0x7f94a7014dc0>",
"<MSInsertArrowAction: 0x7f94a7010400>",
"<MSToggleAlignmentGuidesAction: 0x7f94a701f610>",
"<MSToggleRulersAction: 0x7f94a7016c10>",
"<MSRevealInLayerListAction: 0x7f94a70092a0>",
"<MSMakeUppercaseAction: 0x7f94a70054f0>",
"<MSInsertMenuAction: 0x7f94a700ec00>",
"<MSAlignJustifiedAction: 0x7f94a7010ca0>",
"<MSShowBorderOptionsAction: 0x7f94a701d070>",
"<MSToggleLayoutAction: 0x7f94a70171d0>",
"<MSToggleSelectionAction: 0x7f94a701fbd0>",
"<MSAddExportFormatAction: 0x7f94a701f050>",
"<MSScaleAction: 0x7f94a7016380>",
"<MSMoveForwardAction: 0x7f94a7011220>",
"<MSShapeAction: 0x7f94a70106e0>",
"<MSAlignLayersLeftAction: 0x7f94a7015b70>",
"<MSRemoveUnusedStylesAction: 0x7f94a701d350>",
"<MSSubtractAction: 0x7f94a7012fe0>",
"<MSJoinAction: 0x7f94a7007670>",
"<MSInsertArtboardAction: 0x7f94a700fd90>",
"<MSToolsMenuAction: 0x7f94a7014ae0>",
"<MSFlattenAction: 0x7f94a70128d0>",
"<MSAlignLayersBottomAction: 0x7f94a7016f20>",
"<MSIntersectAction: 0x7f94a70132c0>",
"<MSPrintAction: 0x7f94a3916c20>",
"<MSBaseStyleAction: 0x7f94a7009640>",
"<MSInsertVectorAction: 0x7f94a700eea0>",
"<MSCollapseAllGroupsAction: 0x7f94a70177c0>",
"<MSCreateSharedStyleAction: 0x7f94a7018de0>",
"<MSMakeGridAction: 0x7f94a7005040>",
"<MSDistributeVerticallyAction: 0x7f94a7014800>",
"<MSTextOnPathAction: 0x7f94a7007000>",
"<MSTogglePresentationModeAction: 0x7f94a7013880>",
"<MSFlattenSelectionAction: 0x7f94a70183f0>",
"<MSInsertSymbolAction: 0x7f94a7011c50>",
"<MSAlignLayersTopAction: 0x7f94a7008930>",
"<MSUngroupAction: 0x7f94a70125f0>",
"<MSAlignLayersRightAction: 0x7f94a70163b0>",
"<MSInsertSharedTextAction: 0x7f94a7012150>",
"<MSRectangleShapeAction: 0x7f94a7010990>",
"<MSClosePathAction: 0x7f94a7012900>",
"<MSDetachSybolInstancesAction: 0x7f94a701ea90>",
"<MSSyncSharedStyleAction: 0x7f94a70190c0>",
"<MSMakeLowercaseAction: 0x7f94a700f1b0>",
"<MSRoundToPixelAction: 0x7f94a70186d0>",
"<MSAutoExpandGroupsAction: 0x7f94a7008ec0>",
"<MSMoveBackwardAction: 0x7f94a70112d0>",
"<MSSaveAsTemplateAction: 0x7f94a70060c0>",
"<MSMirrorAction: 0x7f94a701d630>",
"<MSResetSharedStyleAction: 0x7f94a70193a0>",
"<MSMaskWithShapeAction: 0x7f94a7016650>",
"<MSResetBooleanAction: 0x7f94a7015380>",
"<MSClippingMaskModeAction: 0x7f94a70068f0>",
"<MSGroupAction: 0x7f94a7012320>",
"<MSFlipVerticalAction: 0x7f94a7006510>",
"<MSScissorsAction: 0x7f94a7012a10>",
"<MSAlignRightAction: 0x7f94a7005d00>",
"<MSMoveToBackAction: 0x7f94a7014240>",
"<MSDistributeHorizontallyAction: 0x7f94a7014520>",
"<MSSplitAction: 0x7f94a70077d0>"
)
自己写的一个插件:https://github.com/sueLan/ArtMold
网友评论