extension flyout menu

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

lee ky
Posts: 22
Joined: Tue Mar 03, 2020 3:59 am

extension flyout menu

Post by lee ky »

/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global $, window, location, CSInterface, SystemPath, themeManager*/
var csInterface = new CSInterface();
function init() {
// Ugly workaround to keep track of "checked" and "enabled" statuses
var checkableMenuItem_isChecked = true;
var targetMenuItem_isEnabled = true;

// Flyout menu XML string
var flyoutXML = '<Menu> \
<MenuItem Id="a" Label="Menu Item1"/> \
<MenuItem Id="b" Label="Menu Item2"/> \
<MenuItem Id="c" Label="Menu Item3"/> \
<MenuItem Label="---" /> \
</Menu>';

csInterface.setPanelFlyoutMenu(flyoutXML); // Uses the XML string to build the menu

csInterface.addEventListener("com.adobe.csxs.events.flyoutMenuClicked", Handler); // Listen for the Flyout menu clicks

}

init();




----------------------------------------------
function Handler() {

prompt("Input your dimensions EX:4x6", "");

}
------------------------------------------------------
Good

-----------------------------
function Handler() {
#include '/S/jsx/NewLayer.jsx'

}
-----------------------------------------
Error!!! No Good


extension flyout menu

I would appreciate if you could tell me how to link "* .js" with ID "a" "b" "c".
schroef
Posts: 33
Joined: Sat Apr 11, 2020 6:22 am

Re: extension flyout menu

Post by schroef »

You need to add a function for that click handles, didn't see that in your code. You are adding a handler for it, but there is no function doing the check.
Ive been upgrading the AnimDessin2 panel for Photoshop, it had the same XML menu with that weird state to check if things are checked. Those are left over from someone i guess. To be able to make them be checked and unchecked, its a bit of a hustle. I did a ver dirty setup for that, but it works.

PS why do you want to include script in click, should you actually call them?
Your handler script doesn't check anything, it will prompt on anything if it even works. An easy way is by adding that same break you see in the code and than add functions for each id number you see or you the same function and loop over the ID values. Then per ID value you call the eval script. PS is that eval script even working properly? Here is another link with some info; https://creative-scripts.com/jsx-js/
Do you have the proper setup with your folders? Is that host.jxs or hostscript.jsx file there?
see the menu in this main.js Look at the bottom for XMLmenu and the function flyoutMenuClickedHandler
https://github.com/schroef/AnimDessin2/ ... js/main.js

hope that gives you an indication of what to add to your script. The part to make them checked and unchecked can be done smarter and more efficiently. But I'm no coder, i just do simple loops hahaha