Jump to content

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?


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 ...


...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.1 ◆ Affinity Photo 1.7.1 ◆ 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.


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.

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


Important Information

These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.