Issue with Keynote position not working in a loop

Thanks so much in advance for any help I could get here. I have encountered a bug I just can’t get around!

I’ve tried everything to loop and place these images but they just don’t budge. I can only affect the “y” value. Can anyone help?

I’m trying to achieve 5 small images being placed horizontally next to each other by incrementing only the “x” value. I can prove the concept if I affect the “y” value alone as in the screenshot below.

Does anyone know what’s going on here? Position 0,0 doesn’t even affect them.

Here is an image of what it’s doing and what I’m trying to accomplish:

I’m inclined to agree there’s a bug here. Interestingly, I can see the X position always being set as 262 pt rather than your 294 pt ( down to something screen resolution/size related perhaps as it didn’t vary with KeyNote window size or position), whereas the Y position, as for you, worked fine for me.

I’ve tried several variations around the code and each one unfortunately resulted in a non-specifiable X coordinate.

Sorry I can’t be more positive on this one.

PSA: Please consider posting code rather than a screenshot of part of the code for any future queries. It is a real barrier for people to try and help you if they first have to type code in from a screenshot and then have to figure out the missing code that isn’t included in the screenshot just to examine the issue first hand. Thank you.

I’m not offering a solution but advice on your script that, you never know, may have an outside chance of being the culprit (I doubt it, though).

Don’t nest application tell blocks inside each other the way they are here. There are one or two boundary scenarios where one might wish to do this, and know how to do it, but generally speaking, there isn’t any reason for one application’s scripting dictionary to be open and accessed within the context of another’s.

Most of the time, you’ll appear to get away with it, because AppleScript is happy to throw silent errors in the background if it thinks it can resolve them itself. But it will impact script performance, and potentially create confusion if scripting terminologies have common terms, such as position, that you might think is being applied to one application, but some other background error can send it up the nested app references until it gets used by another.


  • The script begins by telling Keynote to activate. Then for absolutely no reason whatsoever, calls System Events (inside the Keynote block, no less), and doesn’t ever have any commands intentionally issued to it.

  • The next line is another command to activate the application that was already activated, and to do it by opening another tell block inside itself.


  • Delete the first two tell enclosures: the first one to Keynote, and the one to System Events. Keep the innermost one only.

  • Remember to review your code as you go, and make sure you can explain to yourself why a particular line has to be inside any tell block. If you can’t, take it outside the tell block and see if it still works. If it doesn’t, you’ll learn the reason by the error generated, and that is helpful. If it does, then you just made your script a bit more efficient and you’ll get more used to being aware of what goes on in the background.

PS. Also, if you copy and paste your code rather than screenshot it, then others can actually get to try your code themselves and be more likely to find the problem for you. I can’t see anyone willing to type out verbatim the script from your screenshot, unless they are incredibly altruistic. Otherwise, I would have been happy to try and offer more helpful insight to remedy the issue.