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

Align to Canvas Option Action Manager Code

Community Expert ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

Does anybody have any action manager code to ensure that the move tool option to align to canvas has been activated and is not left on selection? I know the code to select the move tool, but not the alignment option for canvas as shown below.

 

canvas.png

TOPICS
Actions and scripting

Views

129

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

correct answers 1 Correct answer

Guide , Jun 29, 2022 Jun 29, 2022

It seems that the state of this option can only be obtained by setting a notifier on the align event and reading the handle after the user has done alignment at least once. Moreover, I did not find a way to force it - if I try to execute the align command with d.putBoolean(s2t( 'alignToCanvas'), true), then we will get an error if the selection-based alignment mode is selected (the same if we write the command into an action).

However, if you just need to understand which mode is currently acti

...

Votes

Translate

Translate
Adobe
Guide ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

It seems that the state of this option can only be obtained by setting a notifier on the align event and reading the handle after the user has done alignment at least once. Moreover, I did not find a way to force it - if I try to execute the align command with d.putBoolean(s2t( 'alignToCanvas'), true), then we will get an error if the selection-based alignment mode is selected (the same if we write the command into an action).

However, if you just need to understand which mode is currently active, then you can wrap it in try...catch and determine the active mode this way (you need to make sure that a selection is not created, since there will be no error if it exists).

You can also set a notifier on the align event and read the descriptor that will be passed to the script (it will explicitly indicate the active align mode). However, this method is less preferable, since we can get data about the event only after the user performs manual alignment.

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 Expert ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

LATEST

Thank you jazz-y!

 

I was hoping for a magic answer. Oh well...

 

I have had to resort to placing a select all before the align to canvas code, then a deselect after the code. This is far from ideal, however, at least it avoids the error and achieves the same end result if the GUI is set to selection.

 

Thank you for looking into this for me.

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