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

How to active ruler / grid with script?

Community Beginner ,
Dec 03, 2017 Dec 03, 2017

Hello,

i try to develop a plugin and the last issue i have to fix is to add a button witch can toggle the grid and the rulers.

i have tried it with the ScriptListerner but the Code Result always break.

have anybody a solution for that problem?

Target: PhotoShop CC 2018

TOPICS
Actions and scripting
1.6K
Translate
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

People's Champ , Dec 03, 2017 Dec 03, 2017

Do you need this? )

app.runMenuItem(stringIDToTypeID("toggleGrid"))

app.runMenuItem(stringIDToTypeID("toggleRulers"))

Translate
Adobe
People's Champ ,
Dec 03, 2017 Dec 03, 2017

Do you need this? )

app.runMenuItem(stringIDToTypeID("toggleGrid"))

app.runMenuItem(stringIDToTypeID("toggleRulers"))

Translate
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 ,
Dec 03, 2017 Dec 03, 2017

yeah, i can not believe that it is so simple

thank you

is there a solution to get the status of the grid and rulers?

so that i just can activate the rulers when the grid is already set

Translate
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
People's Champ ,
Dec 03, 2017 Dec 03, 2017
LATEST

For the rulers, use this code in CC2018

var r = new ActionReference();

r.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "rulersVisibility" ) );

r.putEnumerated( charIDToTypeID( "Dcmn" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );

var rulers_is_visible = executeActionGet(r).getBoolean(stringIDToTypeID("rulersVisibility"));            

alert(rulers_is_visible)

For the grid so far, they have not done it yet, I think so ).

UPD.

You can use

app.runMenuItem(stringIDToTypeID("showAll"))

or

app.runMenuItem(stringIDToTypeID("showNone"))

Then toggle the necessary view.

In order to see the menu code in ScriptingListenerJS.log, use the "insert menu item" in the action palette menu when you record the action.

Translate
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