Jump to content

Recommended Posts

-

Further options may come later, hopefully ...

One thing I am hoping for is a way to edit a macro by inserting a step somewhere other than at the end of the existing steps. I would also like to be able to just save the edited version as a replacement for the unedited version, overwriting it, instead of the save creating a new macro.

 

If either of these things is already possible & I have just overlooked how to do them, or if you know of a workaround for either one, please let me know!

 

In particular, I would like to be able to add one or two steps at the very beginning of an existing macro. I have several macros whose current first step is Duplicate, but I have realized that they would work better if I inserted a Clear selection & a Set current selection step before the Duplicate step to set the document to a known state.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

well these things can be solved by doing work yourself 

Do you mean by rewriting the macro from scratch, starting with the missing steps I want to add to my existing macros?


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

I not very good at macros yet but, if you want to add steps at the beginning, couldn't you write a tiny macro which performs those steps and then calls the original macro?

 

Not sure if you can do that but it seems worth a try?

 

Share this post


Link to post
Share on other sites

I not very good at macros yet but, if you want to add steps at the beginning, couldn't you write a tiny macro which performs those steps and then calls the original macro?

Great Brilliant suggestion!!!

 

For some reason I did not think it was possible for one macro to call another macro so I never tried doing that before but after reading your post I just tried it ... & it works! I have not yet checked to see if it still works if a called macro's name is changed, & of course I would not expect it to work if the called macro was later deleted, but even so it opens up quite a few possibilities for a more modular approach to using macros that I want to explore.

 

However, there is still one thing stopping me from doing what I wanted to do for macros that start with a Duplicate layer step. My (less than brilliant) idea was to use the the named layer choice with the Set current selection step to make sure my macro operated on the layer named "Background." I had hoped that if there was no layer with that name, the macro would throw an error & stop.

 

Alas, that does not happen -- the macro seems to just use the top layer if the named one is not present in the document.  :mellow:

 

Other than that, selecting a layer by name works OK, which can be useful.

 

As an example, attached is a macro that duplicates the currently selected layer (which must be named "Background" for everything to work right), names it "RED" & then duplicates the layer named "Background" twice more to create duplicates named "GREEN" & "BLUE." After that, it is easy to select each of the duplicates by name, which this macro uses to clear two color channels of each of them, leaving the RED layer with just the red color channel values of the original layer, the GREEN one with just the green channel ones, & so on.

 

To tidy things up, it then sets the blend mode of each of these layers to Difference (but as written that can be changed for each layer) & finally hides the original Background layer.

Add RGB channels.afmacro.zip


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

Difficulty is it's very hard to see what's going with AF macros as there is no real way to debug. The history palette shows only the macro name and not the steps, and the macro recorder/player has no single step debug function. I love the way the AF macro recorder can handle Dialogues but in other respects (no multiple layer select, no functional cut, copy, paste, and numerous other basic steps) it still has a way to go. Lets hope this is one of the major improvements in the next release.

Share this post


Link to post
Share on other sites

R C-R I am curious. I hope I am not going to curse my own stupidity when you reply, but how do you clear colour channels for a single layer at a time without affecting all layers?

Share this post


Link to post
Share on other sites

R C-R I am curious. I hope I am not going to curse my own stupidity when you reply, but how do you clear colour channels for a single layer at a time without affecting all layers?

After selecting a layer in the Layers panel, the Channels panel shows below the Composite channels a second set of channels for that layer only, with Composite replaced in the channel name with the layer name, like this:

post-3524-0-08912300-1497798786_thumb.jpg

Right-clicking on those layer-specific channels pops up the menu with the Clear, Invert, etc. options. They apply only to that layer.

 

Because the default height of the Channels panel is not very tall, you may have to scroll down to see the layer channels. I find it more convenient to float the Channels panel & make it tall enough to see all the channels without scrolling.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

Ah! Not an embarrassing forehead slap 'cos I missed something I knew. Something new learned instead. Very interesting. Thank you!

 

I now I have an idea for your macro. Not being terribly macro literate it may not come in a mad rush ......... 

Share this post


Link to post
Share on other sites

Difficulty is it's very hard to see what's going with AF macros as there is no real way to debug.

The only way I have found to debug a macro is by tedious trial & error. The AP help topic is not at all helpful with this -- it even says, "Through the Macro panel, you can record any operation in Photo; from applying a Gaussian Blur to adding a gradient fill." Of course, this is far from true, so we are left to discover for ourselves what operations it actually supports & (to put it kindly) any quirks the supported ones might have.

 

That is even more tedious than it needs to be because (among other things) as you said there is no way to step through a macro; or to reorder or insert new steps among the existing ones, or even to save edits back to the original macro without creating a new one.

 

Hopefully, all this will improve in later versions but for now we really need much more detailed, comprehensive info about which operations are supported.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

 The AP help topic is not at all helpful with this -- 

 

Well, as long as it's only this !


Windows PCs. Photo and Designer, latest non-beta versions.

Share this post


Link to post
Share on other sites

OK R C-R ..... Surprise!!

Here is your macro duly modified to work on any pixel layer, with any name, anywhere in the stack. 

 

Given my meagre macro skills I am rather chuffed about this!  B)

 

Whilst there is little you can do to insert or remove lines in macros I have discovered there are two things you can do to modify an existing macro. You can switch instructions off by unchecking them and, once you have it open in the editor, you can hit Record and start recording again to append extra instructions onto the end. I never realised this until I tried it today.

 

So this is what I have done:

 

I have turned off the last three lines of your macro which deselected the blue layer, selected the 'Background' layer, and turned off it's visibility. This causes the original macro to terminate with 'BLUE' layer selected. I have then appended the following two lines: Move down one layer relative to selected, Turn off visibility. 

 

That's it. As far as I can see it works perfectly. I hope so and that there isn't some pitfall awaiting. I am reasonably confident it is watertight.  

So it's my thank you for teaching me something about channels that I didn't know.  :)

NewRGBChannels.afmacro.zip

Share this post


Link to post
Share on other sites

funny.gif

Well, as long as it's only this !

 


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

That's it. As far as I can see it works perfectly. I hope so and that there isn't some pitfall awaiting. I am reasonably confident it is watertight.

It avoids one of the problems if there is no layer named "Background" in the image but alas, try it with no layer selected before running it -- it fails to create the RED layer.

 

That is the problem that initially caused me to hope that by starting with a Clear selection step followed by a Set current selection step (so I could specify the Background layer explicitly by name in the second step of the macro) it would stop if the Background layer was not preselected.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

Well yes - that may be. But no macro can be expected to run correctly if run under incorrect circumstances. Error checking and avoidance lies more in the province of full scripting. It's kind of axiomatic that you need to start with a layer selected for a macro to work on. Not sure there's a way out of that.  ;)

Share this post


Link to post
Share on other sites

 It's kind of axiomatic that you need to start with a layer selected for a macro to work on. Not sure there's a way out of that.  ;)

 

The problem is that it can work with no layer selected once the macro has been saved. During recording you can specify a layer by relative position (one from the top, one from the bottom, etc.) but unless the relative position of the layer you want the macro to target will never change, then the macro is not going to be very useful -- consider a 20 layer document with some edits already applied for example.

 

That leaves the select by name option (like Select layer named "Background") as the closest thing we have to a non-relative selection. But if there is no layer with that name, when the macro is run it just selects a layer anyway & starts running its steps on that. The simplest way around that is to make the macro do nothing (with or without an error) if the named layer does not exist.


Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

I am rather lost as to why you seem to need this so complicated. This particular macro breaks down a layer into it's RGB components. Why is it problematic to simply select the layer you want to do this to before running it? 

Yes it would lovely if it could tell if you don't have one selected and bail out.  But macros are not scripts that can make conditional choices and they are not supposed to be. They are simply recorded sequences of actions with very limited feedback (Photoshop actions have far less interaction than AP's macros).

 

Certainly if AP's own error checking were better, when it comes to asking it to do things it shouldn't, then some of what you seem to be seeking might exist as an intrinsic part of the app regardless of whether called from a macro or performed manually. I have frequently complained about AP's tendency to plough on regardless and fail if I ask it to do something it can't (like trying to apply FX to a mask layer) instead of sending me a warning. This is something that needs improving - but it is not macro specific, it's global. 

AP (and all graphics utilities) demand to be used with a certain degree of respect for certain basic requirements - like having layers selected if you want to apply FX or filters to them. Macros are no exception to this as they are simply a dumb sequence of recorded steps, warts and zits included. 

Dumber than even us poor befuddled users ..........  :(

Share this post


Link to post
Share on other sites

Yes it would lovely if it could tell if you don't have one selected and bail out.  But macros are not scripts that can make conditional choices and they are not supposed to be.

I am not asking for macros to make conditional choices like scripts can do, just to halt when an error occurs. There is a difference.

 

As for why it is problematic to select the layer first, imagine a document with dozens of layers, or running the macro as part of a batch job.

 

EDIT: More simply, if during recording the macro asks me to make a choice between selecting a layer by its relative position or by name, then if it can't do the latter during playback, that by name choice should not be available during recording to begin with.

Edited by R C-R

Affinity Photo 1.7.1, Affinity Designer 1.7.1, Affinity Publisher 1.7.1; macOS High Sierra 10.13.6 iMac (27-inch, Late 2012); 2.9GHz i5 CPU; NVIDIA GeForce GTX 660M; 8GB RAM
Affinity Photo 1.7.1.143 & Affinity Designer 1.7.1.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iOS 12.3.1

Share this post


Link to post
Share on other sites

I am not asking for macros to make conditional choices like scripts can do, just to halt when an error occurs. There is a difference.

 

As for why it is problematic to select the layer first, imagine a document with dozens of layers, or running the macro as part of a batch job.

 

EDIT: More simply, if during recording the macro asks me to make a choice between selecting a layer by its relative position or by name, then if it can't do the latter during playback, that by name choice should not be available during recording to begin with.

Hmmmm .... I see what you mean now.

 

Deciding whether to make an action record a layer name or a relative layer was always a problem in PS too as actions didn't provide the wherewithal to stop and input a name on playback either. (At least not up to CS6. It may have changed since). Many PS actions depended on you being on a particular layer type or layer before being run. I have always simply accepted this a limitation of actions and have accepted it as a limitation of macros too.

 

That being said however, nine times out of ten PS would bail out if it came across an error such as 'layer not found' and the action would stop (with an error message) exactly as you are requesting. This takes me back to my earlier comment in this thread about AP's tendency to plough on regardless if you ask to do something it shouldn't. The failure to stop on error is not a failure of macro recording or playback per se - it is a general failure in AP's rather weak error trapping. There are lots of instances of AP's failure to stop on error and I am certainly not the only one to have mentioned this in the past.

 

I think what this exchange between on us macro recording has done is to highlight something much deeper rooted ....... that I perceive as AP's Achilles heel.

 

......... in which particular instance he is perhaps a many legged creature ......... ;)

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

×