• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

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.

TOPICS
SDK

Views

781

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

That's a fair answer. Playing an action is often a workaround to a missing C++ API, though it can come with constraints. For something like this though, it probably does the job. @Rick E Johnson is right as well about examples on the forum: I know I've read & answered many questions on PlayAction, just do a search for that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 01, 2023 Apr 01, 2023

Copy link to clipboard

Copied

One issue when using actions this way is that you won't get back much meaningful information, just an error code. If the action creates or changes art, it will be selected -- the same is true for the swatches in your case. You will have to figure out for yourself if the action did anything useful.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 02, 2023 Apr 02, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 03, 2023 Apr 03, 2023

Copy link to clipboard

Copied

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);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 03, 2023 Apr 03, 2023

Copy link to clipboard

Copied

LATEST

Hi Rick E Johnson,

It's working fine, Thanks for the help!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines