Jump to content

Recommended Posts

HI I've checked the forum and did not find the answer to this,

I'm trying to group several adjustment layers and standard layers while recording my macro, but I cannot select the layers individually in the layers panel to group them i get this popup asking me to pick a single layer. When i use the "select - select all layers" command it works, but when i run the macro (on a new file with multiple layers), any layer that is not locked gets placed in the group the macro created (i don't want this).

Am i missing something, is there a better way to select the layers and group them while recording a macro?

Forgot to mention i'm running affinity photo 1.7.3.481

Edited by icanteven

Share this post


Link to post
Share on other sites

Trying here on Mac and this seems to be a big omission in macro recording, to be honest I have not done much with macros because of this sort of limitation.


MacBook Pro (13-inch, Mid 2012) Mac OS 10.12.6 || Mac Pro (Late 2013) Mac OS 10.14.5

Affinity Designer 1.7.3 | Affinity Photo 1.7.3 | Affinity Publisher 1.7.3 | Affinity Designer Beta 1.8.0.2 | Affinity Photo Beta 1.8.0.163 | Affinity Publisher Beta 1.8.0.531

Share this post


Link to post
Share on other sites

Yip some things won't work that well here at all, however the following video entitled "Macros: Layer Behaviour" may be helpful here since it shows some workarounds related to layers ...

Macros

Macros 1.5


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

Share this post


Link to post
Share on other sites

Thanks for the videos v_kyr, it explains the layer popup i was getting.

I guess ill just save the macro w/o grouping and group the layers after i've applied the macro.

Thanks for the help guys...

Share this post


Link to post
Share on other sites

 

18 hours ago, icanteven said:

but when i run the macro (on a new file with multiple layers), any layer that is not locked gets placed in the group the macro created (i don't want this).

Recording commands in a Macro don't always work the same as when you do it outside of the macro studio

But there are different ways of getting the macros to work and achieve the desired results

If you can supply a sample troublesome file and a description of what you want the macro to do, someone may be able to find a way to do it for you.


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites

Hi Carl123,

There is no issue the macro i created works fine, i just want to tidy up the layers panel by having all the adjustments and layers the macro creates grouped beforehand.

Basically i'm trying to recreate an arch viz. Photoshop script that i use in my workflow to AP. (see video below). 

I want the AP macro to do the following:

  1. create pixel layer and fill with white set to multiply, rename it Value isolation layer (so b&W adjustment can affect the layers outside group)
  2. create B&W Adjustment, rename it Value isolation layer
  3. create pixel layer and fill with red (r:255, g:0, b:0) set to luminosity, rename it hue isolation layer
  4. create pixel layer and fill with red (r:255, g:0, b:0) set to hue, rename it saturation isolation layer
  5. create HSL Shift Adjustment, set saturation shift to 45% rename it saturation isolation layer
  6. group the 5 layers
  7. stop recording.

Its number 6 that's giving me the issue, the only way I've been able to select all the layers while recording the macro is by going to the Select, Select All Layers. As i noted on my original comment, if I record the command this way and run it on a new document with many layers, all layers not locked get placed inside the group the macro creates, which is something i do not want. Which is why i think my only option is to record the macro without grouping and then group the 5 layers after running the macro, unless someone know a better way.

Thanks

 

Share this post


Link to post
Share on other sites

Well without the requested sample document I can only speculate.  But if I had adjustment layers and pixel layers in my document and wanted to group some but now all of them this is how I would do it

For Step 6 try these macro commands

Select > Select all Layers
Layer > Lock

Use the mouse (in Layers panel) to unlock the 5 layers you want to group

Select > Select all Layers  (will now only select the ones I want grouped)
Arrange > Group

Layer > Unlock All  (to unlock the layers you previously locked) 
Layer > Unlock All  (you sometimes have to do it twice to be sure)


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites

I was just messing around so i did not save the file, but see attached AP file for new sample file. I also tried what you mentioned above and it did not work, the layers do not get grouped, i exported the macro in case i messed up your instructions.

 

Thanks again for the input.

test.afphoto

HSV Check.afmacro

Share this post


Link to post
Share on other sites

Ok, it looks like the problem is with the macro command "unlock"

Despite the fact that the macro records the command correctly, when replayed it does not unlock the layer.  It appears that when unlocking a layer in a macro the layer has to be selected first, which is not the case when just using the program normally.

(Possibly a bug - but definitely confusing & undesired behavior)

To correct for the above "bug" I altered the macro to simply select the top layer then Layer > Unlock and repeated for the next 4 layers (down from the top one)

I have attached the revised edited macro where I have simply unticked certain "wrong" commands then added the correct ones below them.

Unfortunately, it only works correctly when you have just the one background layer, if you have more than one background layer it does not select the correct layers for grouping (possibly another bug!)

In a quick test if you select the layer you want to unlock by its layer name then it appears to work no matter how many background layers you have.  Unfortunately, you have named some of your layers with the same name (i.e. S Isolation & V Isolation) so I can't test it properly with the macro you have currently supplied.

If you understand the above you should be able to alter your macro (use unique layer names) add the grouping commands and test it to completion.

If not, if you supply a new version of your original macro with unique layer names I can add the rest of the commands to do the grouping and see if we run into any more bugs.   

 

HSV Check-2.afmacro


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites
6 hours ago, carl123 said:

 It appears that when unlocking a layer in a macro the layer has to be selected first, which is not the case when just using the program normally.

When using the app normally or any other way, how can you lock a layer if it is not selected?  O.o


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites
46 minutes ago, R C-R said:

When using the app normally or any other way, how can you lock a layer if it is not selected?  O.o

I don't think you can

But you can unlock layers which are not selected - which is what I was doing when recording the macro


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites
3 hours ago, carl123 said:

But you can unlock layers which are not selected - which is what I was doing when recording the macro

But I don't think you really can unlock any specific layer without selecting it in some way first, even though in the GUI it can look as if you can.

I realize that in the Layers panel, you can click on a lock icon on an unselected (not highlighted) locked layer to unlock it, but by clicking on that icon you are explicitly selecting that specific layer as the target object of the unlock command. That is one of the characteristics of a GUI that is often overlooked -- clicking on some object selects it in addition to whatever else the click might be programmed to do, which may or may not leave that item selected afterwards.

I believe that is why in a macro the layer has to be selected first, & also why selecting a layer opens the Select Layer window with its choices even if a layer is selected (highlighted) in the GUI or the Cannot record "Set current selection" notice appears if no layer is selected.

IOW, selecting an object as the target for a command & executing a command on a targeted object are two different things. As in a real scripting language, in the macro recorder each of them must be defined explicitly & in the correct order or the command will not work.

Does that make any sense to you?


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites
 
 
 
 
27 minutes ago, R C-R said:

Does that make any sense to you?

Not really.

The macro clearly records me "unlocking" each of the 5 layers as I unlock them on screen

If what you are suggesting is that I am actually "selecting, unlocking, then deselecting" each layer then the macro should be recording that

Alternatively, it should throw up one of those (far too common error boxes) saying that the macro "cannot record that action".

It makes no sense for a macro to record actions/keystrokes which can then no longer be replayed and produce the same effect you got when recording the macro.

 


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites

AFAI recall (didn't tried yet for 1.7.3) the whole layer selection stuff for macro recording was more or less limited and some things always more menu operation bound. And just from menu usage when nothing (no layer at all) is selected, there is only the "select all layers" command available, meaning without some mouse interaction in order to select a specific layer from the layer panel, there isn't a way from menus. - Apart from that another thing which is often useful for macros, when it comes to direct layer selections is, to name created layers and giving them a unique name, since that eases the layer selection process in macros.

 


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

Share this post


Link to post
Share on other sites
40 minutes ago, R C-R said:

selecting an object as the target for a command & executing a command on a targeted object are two different things. As in a real scripting language, in the macro recorder each of them must be defined explicitly & in the correct order or the command will not work.

In a real scripting language (let's assume an OO-capable one so that we can definitely use the term object as a language construct) every created object has a name you can access it with and certain object properties. The order how a certain object and its properties are used here, are thus more dependent on the outer context usage (dictated by that) than the object itself. So the behavior is overall more context implementation dependent (in this case the APh macro facility) than anything else.


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

Share this post


Link to post
Share on other sites
17 minutes ago, carl123 said:

The macro clearly records me "unlocking" each of the 5 layers as I unlock them on screen

If what you are suggesting is that I am actually "selecting, unlocking, then deselecting" each layer then the macro should be recording that

What I am saying is selecting an object in the GUI (IOW, by using the mouse) is not the same thing as recording a step in the macro recorder.

A macro has no way of knowing what the GUI will look like when it is run in the future -- the Layers panel might be in a different location on the screen, floating or attached to the workspace window, part of a tabbed panel group or not, or even not open at all. Likewise, a workspace object could be anywhere on the screen or not visible in it. In fact, the macro might be running on a different computer running a different OS with an entirely different workspace layout.

 So where you click with the mouse in the GUI --  the x & y screen coordinates of the click -- is not recorded as part of a macro step. Doing that would be pointless because those coordinates could be the location of anything or nothing when the macro is run.

IOW, selecting an object means one thing in the GUI -- the object is highlighted & is the target (focus) of whatever comes next -- but that is not the same thing as selecting (targeting) an object as the focus of a macro step. We usually think of highlighting & selecting a target as the same thing in a GUI environment but that is not really true -- it is two things done in succession.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites
13 minutes ago, v_kyr said:

In a real scripting language (let's assume an OO-capable one so that we can definitely use the term object as a language construct) every created object has a name you can access it with and certain object properties.

Sure. But in a real scripting language every object reference must be uniquely identifiable in some way, like with a unique name or automatically generated UUID (or both). If a script fails to supply that reference it will not run properly & (hopefully) will generate an informative error message of some kind indicating why the reference cannot be determined.

It is much the same in the AP macro recorder, except that it won't record the step unless/until the object reference is made explicit.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites
 
 
 
 
10 hours ago, R C-R said:

So where you click with the mouse in the GUI --  the x & y screen coordinates of the click -- is not recorded as part of a macro step. Doing that would be pointless because those coordinates could be the location of anything or nothing when the macro is run.

One of the leading macro programs (iMacros) has been supporting that since it was first released. Using the x & y screen coordinates has had many names over the years but is now called Direct Screen Technologyhttps://wiki.imacros.net/DS

It is a simple but hugely powerful command and I still have and run several of these, auto-scheduled, macros every day to post adverts, fill in forms and grab screen data using Direct Screen commands.  So to imply that macros don't record the x&y coordinates or doing so would be pointless is clearly wrong.

I have no idea how affinity Macros work or what screen recording technology they use and to be frank I should not have to know.

 

Anyway, we are going way off topic trying to delve into the undelaying coding structure of the Affinity macro system - all I am saying, as a user, is that the (Affinity) macros should not be "successfully" recording my commands and then not replay them.


PS iMacros rocks, for anything browser-based it can't be beaten for recording & automating repetitive tasks. Which is the basic function of what a macro should do. 

 


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites
3 hours ago, carl123 said:

PS iMacros rocks, for anything browser-based it can't be beaten for recording & automating repetitive tasks. Which is the basic function of what a macro should do. 

AP is not a browser. As for recording the x & y coordinates, consider that the x & y screen coordinates of a particular layer in the Layers panel in one document could be entirely different in another document, or that often there will be no corresponding layer at those coordinates, or that the Layers panel itself may not even be at the same screen location so the recorded x & y screen coordinates may not even be anywhere in that panel.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites
34 minutes ago, R C-R said:

AP is not a browser

No one is advocating that AP uses  x & y coordinates to do anything "menu" based - just that several macro programs do so very successfully.

AutoHotKey is a highly praised windows based macro/scripting program that works in any application not just browsers and also supports x & y coordinates.

https://www.autohotkey.com/docs/commands/MouseGetPos.htm
https://www.autohotkey.com/docs/commands/MouseMove.htm

To dismiss this facility/function as "pointless" just means you have never had a need for it or understand just how powerful it can be in certain circumstances.


Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Share this post


Link to post
Share on other sites
1 hour ago, carl123 said:

To dismiss this facility/function as "pointless" just means you have never had a need for it or understand just how powerful it can be in certain circumstances.

Not at all. I am just saying there is no point in recording x & y coordinates in Affinity Photo macros because the x & y coordinates that would be recorded are those of the mouse pointer on the display. Thus, they have no relationship or relevance to selecting a layer from the Layers panel (because that panel could be anywhere on the display, including on a different monitor in a multi-monitor setup). 

This is why I keep talking about how a GUI works. When you click on something with a mouse (which you can only do in a GUI), the location (the x & y screen coordinates) of the mouse pointer are sent by the OS to whatever is 'under' the pointer at that moment in time. If it is something in an application window (because it is frontmost & thus has the focus), that info is sent to that app, which then determines what (if any) event (lock, unlock, select some object, whatever) should occur as a result of the mouse click at that screen position.

But since for example a layer in the Layers panel or an object in the workspace could be anywhere on any of one or more screens, if a macro used the screen coordinates that were recorded during the creation of the macro, the results would be unpredictable because an entirely different object (or none at all) might be at those screen coordinates when the macro was played back.

This is why when recording an AP macro selecting a layer object has to be done explicitly as a separate step in a way that is not dependent on any screen coordinates, for example in the "Select Layer" window using a reference like "Select layer named <layer name>" or "Select layer 1 from the top" or "Select layer 5 from the bottom," etc.

It would be much the same if AP supported a scripting language, which it may well do in some future version. It might be possible to script moving the mouse pointer & thus the application's focus to some screen coordinate location in the workspace window or in a studio panel to mimic what a user would do in the GUI, but since anything or nothing could be at that location when the script is run, there would be little point in scripting that, at least not without a lot of "sanity checks" to make sure the script doesn't then try to do something at that location that can't be done, which would throw an error & halt the script.

So yes, I do understand quite well how powerful macros & scripts can be, but I also understand that there is much more to it than just recording or specifying x/y coordinates & expecting anything based on that to work reliably in all but the most limited of circumstances.


Affinity Photo 1.7.3, Affinity Designer 1.7.3, Affinity Publisher 1.7.3; 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.3.155 & Affinity Designer 1.7.3.1 for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 13.1.2

Share this post


Link to post
Share on other sites

AFAIK APhoto macro recording and playback works overall more layer and command oriented. Meaning here ...

  • It can't record a plain or arbitrary x/y-pos based on screen area selection, it will always want to have some layer to select.
  • If layers aren't by the user clearly/uniqued named, it just uses the during recording/playback associated layer stack position/Nr (from top or bottom of the stack).

 


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

Share this post


Link to post
Share on other sites

Thank you Carl123, your work around worked!

I unlocked by selecting the layer name and now the  macro works as intended, i was also able to rename the group and clear selection before stopping the recording.

Thanks again for the help.

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

Please note the Annual Company Closure section in the Terms of Use. 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.