Skip to main content
Known Participant
April 1, 2023
Question

How to trigger “Select All Unused” flyoutmenu of “Swatches Panel” in illustrator sdk using c++

  • April 1, 2023
  • 2 replies
  • 1355 views

Hi all,

AIAPI AIErr(* GetFlyoutMenu )(AIPanelRef inPanel, AIPanelFlyoutMenuRef &outFlyoutMenu)

For the above code, what is the first parameter need to be passed for swatch panel.

This topic has been closed for replies.

2 replies

Rick E Johnson
Inspiring
April 1, 2023

It's possible to record an action for that, so it's probably also possible to create and run that action on the fly. If you search this forum, I'm sure you'll find it.

Known Participant
April 3, 2023

Hi Rick E Johnson,

Thanks for the help!!!

How to create new action to trigger “Select All Unused” flyout menu of swatches panel in illustrator sdk using c++

Can you please provide sample code for this.

Rick E Johnson
Inspiring
April 3, 2023

This post on this forum isn't specifically about swatches, but will show you how to create and run a path offset action on the fly.

The SDK header AIActionManager.h has a lot of helpful information in it, as well as the Tutorial project in the SDK sample code.

If you record your menu selection as an action, then save the actions and open your .aia file, you can see the values the action manager needs.

/action-28 {
/name [ 11
737761746368206d656e75
]
/keyIndex 0
/colorIndex 0
/isOpen 1
/eventCount 1
/event-1 {
/useRulersIn1stQuadrant 0
/internalName (ai_plugin_swatches)
/localizedName [ 8
5377617463686573
]
/isOpen 0
/isOn 1
/hasDialog 0
/parameterCount 1
/parameter-1 {
/key 1835363957
/showInPalette 4294967295
/type (enumerated)
/name [ 17
53656c65637420416c6c20556e75736564
]
/value 11
}
}
}

In the "name" field, note that 53656c65637420416c6c20556e75736564 translates from hex to ascii as "Select All Unused"

I haven't tested this code, but it should at least give you a good start. I use a lot of std::string, but you'll likely want to use char* instead.

AIActionParamValueRef param;
AIErr error = kNoErr;
ActionParamKeyID key(1835363957);
std::string val("Select All Unused");
error = sAIAction->AINewActionParamValue(&param);
error = sAIAction-> AIActionSetEnumerated(param, key, val.c_str(), 11);
error = sAIAction->PlayActionEvent("ai_plugin_swatches", kDialogOff, param);
error = sAIAction->AIDeleteActionParamValue(param);

 

A. Patterson
Inspiring
April 1, 2023

You can't do what you're trying to do. That API is purely so you can create & manage your own panels, not manipulate other plugin's panels.

 

There is no C++ API for interacting with the UI of any shipped pluign directly.