Jump to content

Process "Get Window Bounds" if Width is less then. . .


Recommended Posts

Hello,

 

"Get Window Bounds" returns for example:

 

{"x":280,"y":105,"width":2000,"height":1200}

 

How can I read the width or the height and select a conditional? For example: "if width is smaller then 2000" then ... else ...?

 

I can't find help about how to process the return of "Get Window Bounds" in the returned format and the conditional if else...

 

Best regards,

Diederick.

Link to comment

Welcome @DCools,

 

That output is valid JSON you can process in a number of ways. Because it’ll be consistent, you can use a Replace Utility set to replace regex .*"width":(\d+),.* with $1, which will give you the width.

 

But we can do better. Automations Tasks 2022.7 was just released with a dropdown so you can return individual details like the width.

Link to comment
Posted (edited)

Yes, Thank you it works thanks to 2022.7 the easy width selection.

 

I will play with the Replace Utility  and regex to understand how it works that way. Regex I understand and use now and then with other script languages.

 

Regards,

Diederick. 

Edited by DCools
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...