Jump to content
rarteagasf

Problem when using expressions in macros // Problema al usar expresiones en macros

Recommended Posts

Estoy intentando incrustar una imagen que debería tener el mayor tamaño posible para que se vea en su totalidad independientemente de las dimensiones del documento base.
Para ello, en el Panel Transformar, vinculo el ancho y el alto e introduzco en cualquiera de los dos la siguiente fórmula: Min(sh;sw) —curiosamente no funciona si uso la coma como separador— y se consigue el objetivo propuesto.
El problema me ocurre cuando hago una macro para automatizar esta tarea, ya que  no me reconoce la fórmula anterior. Al parecer lo que almacena es el resultado de la misma.
¿Alguien sabe si es posible incluir una fórmula en una macro y que los cálculos se realicen correctamente en cada uso?
Gracias,

------------

I'm trying to embed an image that should be as large as possible so that it looks completely independent of the dimensions of the base document.
To do this, in the Transform Panel, I link the width and height and I enter the following formula in either of them: Min (sh; sw) -curiously it does not work if I use the comma as a separator- and the proposed goal is achieved.
The problem occurs to me when I make a macro to automate this task, since it does not recognize the previous formula. Apparently what you store is the result of it.
Does anyone know if it is possible to include a formula in a macro and that the calculations are performed correctly in each use?
Thank you,

Share this post


Link to post
Share on other sites

No sadly it doesn't work like that for Affinity expressions, meaning these are always value expanded during initial recording and not kept as dynamic evaluated values. Thus when you replay a macro it doesn't dynamically (re)calculate a previously inserted expression, since it recorded the previously expanded values and takes those into account.

So the whole with expressions is pretty useless for trying to build up some dynamic behaving macros at all here! - See also an similar themed older thread:

Related to ...

Quote

...Min (sh; sw) -curiously it does not work if I use the comma as a separator...

... yes this doesn't work with a comma as a function value seperator at all here and is possible overall wrong documented in the online help. - All in all the Affinity documentation is pretty short, limited and weak on the usage of expressions and macros etc. here, so the whole is finally always more a matter of usage try and error instead.


☛ Affinity Designer 1.7.0 ◆ Affinity Photo 1.7.0 ◆ OSX El Capitan

Share this post


Link to post
Share on other sites

What usually works in these circumstances is Filter > Distort > Equations. You can enter formulae to change the width or height  and they do work in macros. See my tutorial here, which might help.

John


Windows 10, Affinity Photo 1.7 and Designer 1.7, (mainly Photo), now ex-Adobe CC

CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630

Share this post


Link to post
Share on other sites

Many thanks v_kyr for your clarification, I had tried many times without getting results.
Thank you very much John Rostron. I'm going to try it with equations.
Greetings,

Share this post


Link to post
Share on other sites

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

×