Jump to content
You must now use your email address to sign in [click for more info] ×

[AP] Apply a macro to each selected layer?


Recommended Posts

Is it possible to make a macro apply to each selected layer individually? Currently when I run a macro it applies only to the topmost layer out of all selected ones.

Affinity Photo 2.4.2 for Windows  OS: Windows 10 Pro x64 ver. 22H2  CPU: AMD Ryzen 7950X 16-core  RAM: 64 GB DDR5-6400  GPU: MSI GeForce RTX 3090 Suprim X 24GB / driver 526.98  NVMe SSD Samsung 980 Pro 1 TB  Monitors: 2x Eizo ColorEdge CS2420 24"

Link to comment
Share on other sites

There are ways to select individual layers in a macro so you can apply a set of steps (or another macro) to them one at a time, but it is tricky to get the selection step to work reliably.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

On 10/4/2019 at 8:37 PM, Alex_M said:

Is it possible to make a macro apply to each selected layer individually? Currently when I run a macro it applies only to the topmost layer out of all selected ones.

Can you give us a specific example of what it is you want to do?

E.g. Are they all image layers, what would the macro do on a layer?

A sample document may help

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

I wanted to make a macro that rasterizes all Image layers I've selected because currently the Rasterize command doesn't work on more than one selected layer.

Affinity Photo 2.4.2 for Windows  OS: Windows 10 Pro x64 ver. 22H2  CPU: AMD Ryzen 7950X 16-core  RAM: 64 GB DDR5-6400  GPU: MSI GeForce RTX 3090 Suprim X 24GB / driver 526.98  NVMe SSD Samsung 980 Pro 1 TB  Monitors: 2x Eizo ColorEdge CS2420 24"

Link to comment
Share on other sites

This may work but it depends on what your workflow and document layout is................

Create a new document and place 5 random images in it

Select the top layer and record the following 2 commands

Rasterize & Trim
Select Layer 1 below current

repeat for the remaining 4 images (image attached)

You now have a macro that will Rasterise 5 image layers assuming they are sequential in your document (just select the top layer then run the macro)

If you have more than 5 image layers just run the macro again from where it ends to do another 5 (repeat as needed)

If you have less than 5 image layers (or multiples of 5) the macro simply ends when there are no more layers to rasterize

If you have 3 images you want to rasterize but have a couple of shapes (or other layers) below them that you do not want to be rasterized, simply deselect the last 2 rasterize commands in the macro before running it

 

 

rasterise.png

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

Thanks a lot, @carl123 , I'll try this!

Affinity Photo 2.4.2 for Windows  OS: Windows 10 Pro x64 ver. 22H2  CPU: AMD Ryzen 7950X 16-core  RAM: 64 GB DDR5-6400  GPU: MSI GeForce RTX 3090 Suprim X 24GB / driver 526.98  NVMe SSD Samsung 980 Pro 1 TB  Monitors: 2x Eizo ColorEdge CS2420 24"

Link to comment
Share on other sites

On 10/7/2019 at 8:37 AM, carl123 said:

Select the top layer and record the following 2 commands

Rasterize & Trim
Select Layer 1 below current

It is a pity we can't edit an existing macro to add a step so it could call itself recursively.... :ph34r:

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

In theory, you can have a macro end by calling (running) another macro which is simply set to run the first macro

Not tried it so you may get into a infinite loop if there's no way to "break" out of it

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

41 minutes ago, carl123 said:

In theory, you can have a macro end by calling (running) another macro which is simply set to run the first macro

What I mean is how do you get a macro to run another macro that can't do that until the first macro is created?

IOW, say you are creating a macro with "rasterize & trim" & "select layer 1 below current" as the first 2 steps. To add a third step to call another macro that in turn runs the first macro, the second macro must exist, & it must call the first macro, right? But the first macro has not yet been saved, so the second macro can't call it.

I probably am not explaining this very clearly, but it seems like without the ability to edit an existing macro by adding a step to it, there is no way to do this (because the edited macro has to be saved as a new macro).

Am I missing something here?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

5 minutes ago, R C-R said:

but it seems like without the ability to edit an existing macro by adding a step to it

You can effectively do that

But it looks like the problem is that when you tell macro1 to run macro2, macro1 simply copies the commands from macro2 into itself.

So it makes no difference to how you then change macro2 as macro1 never actually runs it

 

 

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

1 minute ago, carl123 said:

So it makes no difference to how you then change macro2 as macro1 never actually runs it

How do you change an existing macro? If I edit any macro to add a step to it, the only way I know to make the edit permanent is to save it as a new macro.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

Save it with the same name and delete the old one of the same name

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

7 minutes ago, carl123 said:

Save it with the same name and delete the old one of the same name

I am not 100% certain but I am reasonably sure macros do not call other macros based on their name references but by some internal UID. Otherwise, since several entirely different macros could have the same name, how would a macro decide which one to copy into its own steps?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

It does not really matter if macros have the same name, the one you select (with the mouse) will have its contents copied into the other macro

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

1 hour ago, carl123 said:

It does not really matter if macros have the same name, the one you select (with the mouse) will have its contents copied into the other macro

Then there is no point in re-saving the macro with the same name & deleting the old one, right?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

You're mixing up two questions you initially raised.

"re-saving the macro with the same name & deleting the old one"

is in relation to when you asked...

"How do you change an existing macro? If I edit any macro to add a step to it, the only way I know to make the edit permanent is to save it as a new macro"

not in any way connected to...

"It does not really matter if macros have the same name, the one you select (with the mouse) will have its contents copied into the other macro"

Which was a response to the discussion on creating a recursive macro

 

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

1 hour ago, carl123 said:

You're mixing up two questions you initially raised.

Yes I am, but I was just trying to point out that there is no way to create a recursive macro, even using the two macro workaround you suggested.

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

25 minutes ago, R C-R said:

but I was just trying to point out that there is no way to create a recursive macro, even using the two macro workaround you suggested.

What I also said was "In theory" and "Not tried it"

Which means you would need to try it to see if the theory was true or false

Only after having now tried it can we conclude that the way macros currently work we cannot call another macro to create a recursive loop back to the original macro.

 

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | 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.