Photoshop.JSX Question
Scenario:
In Photoshop.jsx, I place all my code for which I want photoshop to perform
For example:
I have a function that performs the zoom in and zoom out commands
Zoom In:
function zoomin(){
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("menuItemClass"), stringIDToTypeID("menuItemType"), stringIDToTypeID("zoomIn"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
}
Zoom Out:
function zoomout(){
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("menuItemClass"), stringIDToTypeID("menuItemType"), stringIDToTypeID("zoomOut"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
}
HTML Form:
On the index.html, I have 2 buttons each with its own id #btn_zoomin and #btn_zoomout
Main.js
In the Main.js file, I call the respective function in the photoshop.jsx file like this...
//Zoom In
$("#btn_zoomin").click(function () {
csInterface.evalScript('zoomin()');
});
//Zoom Out
$("#btn_zoomin").click(function () {
csInterface.evalScript('zoomout()');
});
Question:
I would like to replace the 2 buttons on the index.html to a single Toggle-Switch but how can I get the Toggle-Switch to call the function(s) in the Photoshop.jsx file.
Any example code would be really appreciated.
Ian
