Can someone help me by writing the following code, please?

I am working on creating my own plugin in uxp format and I have most of the buttons ready and they all work perfectly
But I have one obstacle standing in front of me, which is defining the face from the eyebrow to the chin.

I use this code:

function main() {
	var oldUnits = app.preferences.rulerUnits;
	app.preferences.rulerUnits = Units.PIXELS;

	var FaceHeight = Math.max(app.activeDocument.selection.bounds[2] - 			app.activeDocument.selection.bounds[0], app.activeDocument.selection.bounds[3] - app.activeDocument.selection.bounds[1] );
GRadius = FaceHeight / Ratio;
        
	//lowR = 15;

	app.activeDocument.selection.deselect();

function Faceselect() {
	var sel = true;
	try {
		var forgetIt = app.activeDocument.selection.bounds
	} catch (a) {
		sel = false
	};

	return sel;
}

I use this code in my panel in (CEP) Format
I tried to convert it to UXP format
But my attempts were unsuccessful

Hi @Mohamad!

Have you read our UXP migration guide yet? It’s here: CEP-Resources/UXP-Migration-Guide at master · Adobe-CEP/CEP-Resources · GitHub

Let us know if this is of any help.

1 Like

Honestly, I’m running the entire script via code to run the .jsx script inside my plugin and it works great. I created a folder called jsx inside my plugin components and it works now. Is this a good solution?
Regards
Mohamed Fathy

No, it is not

Thank you, I will work hard on converting it to uxp format
I am working on developing it soon
I also use it for personal use only
Regards
Mohamed Fathy

How can I use it by trying it on the CEP plugin But I didn’t know how to guide me Regards Mohamed Fathy…