I am trying to use alchemist to get the right property for this.
I inspect the Document properties.
I “Add” the current state, change the guides to show/hide and “Add” again.
The difference selection shows that both are the same.
What am i doing wrong?
How can add a button to show/hide the guides in my uxp plugin
Thanks
sttk3
February 26, 2024, 12:46am
2
Try turning on Listener instead of Inspector.
The only result that could be recorded is the invokeCommand
, so it seems that it would be necessary to make sure that the number commandID
is always reliable or not.
{
"_obj": "invokeCommand",
"commandID": 3503,
"kcanDispatchWhileModal": true,
"_isCommand": false
}
Sometimes docs is a good place to start
Thanks, I am already using this, however this is how I create or delete the guides. It doe snot have an option to show or hide them.
Gotcha. Misunderstood the intention
Thanks. I already tried the ‘Listener’.
This is is not working.
“invokeCommand” is for your information only. This tells you what happened in Photoshop. But this can’t be played.
sttk3
February 26, 2024, 6:57am
7
This is achieved by executing performMenuCommand based on the recorded commandID.
const { core } = require('photoshop') ;
await core.executeAsModal(async () => {
await core.performMenuCommand({commandID: 3503}) ;
}, {}) ;
How can I know the current state for the guides, whether they are shown or not?
1 Like
sttk3
February 26, 2024, 9:39pm
9
It should theoretically be possible to check this with getMenuCommandState .
However, this method found by kbsanders seems more reliable. I actually tried it.
Update: After hours of trying different things to invalidate menuBarInfo with no joy and finally digging through the internal UXP JavaScript for answers, I came across the following descriptor that does exactly what I need. It produces a real-time uncached status for a given menu item (commandID) including both the enabled and checked properties.
{
_obj: 'uiInfo',
_target: {
_ref: 'application',
_enum: 'ordinal',
_value: 'targetEnum',
},
command: 'getCommandEna…
1 Like
thanks, working…
async function myCommandState(tool) {
var result;
await require("photoshop").core.executeAsModal(async (executionControl, descriptor) => {
result = await batchPlay(
[
{
_obj: 'uiInfo',
_target: {
_ref: 'application',
_enum: 'ordinal',
_value: 'targetEnum',
},
command: 'getCommandEnabled',
commandID: constmenuCommandCode[tool],
}
],
{}
);
});
return result[0].result;
}
where constmenuCommandCode is my own array with toolName: tooId
1 Like
haller
February 27, 2024, 8:26am
11
sttk3:
commandID: 3503
sttk
I wanted to know if these id commandID: 3503 they are good for both mac and pc and if there is a possibility that they will change in the future, I know that those that change have a negative value like -1549.
There are multiple posts about command IDs in the forum, but to summarize in short:
Negative IDs may change even on re-opening the Ps
Positive IDs are the same on Win and Mac
Positive IDs should be persistent, but they aren’t. Here’s the case when Adobe decided to just change the ID
2 Likes