Sorry, I had to call it a day yesterday.
So, I corrected my typo, and I got it running to "completion", 3.2 seconds. The problem is that it only marked the rectangular selection, but did not zoom in, even though it ran to the last action and I got the "speak text" action. Strange...
Your Norwegian keyboard may be the cause of that last failure. My code used SHIFT-CMD-8 but I think on your keyboard you must change that to SHIFT-CMD-@. I'm not really sure but that's what your earlier post suggests. Did you update my macro in that location to take account of this difference in your keyboard? If not, perhaps upload an image of your latest macro so I can see it.
This is a full pic of one of the macros I made that takes a bit too long for me to really take advantage of. I've made more of them just for different thirds of my two external monitors.
Good eyes. I changed it now, but assumed it didn't matter. Still the same 3.2 seconds, but this time, no rectangular area in preview is even selected...
As for the delay issue, I'm not really attacking that until we get the coding issues addressed. I'm trying to replace your Type actions with Menu actions. It's taking a few minutes. because Preview appears finicky.
Okay, because of the trickiness of using the Type action (especially due to Norwegian Keyboards) I decided it would help to replace the Type Actions with actions that Select Menu items by name. This did increase the size of the program, which is never good, but many of the items in my new program are for debugging so it's not as bad as it looks. Some of the code is because Preview has contextual and delay issues. Which isn't our fault. I think this may resolve the problem of your keys not working, which is partly due to the Norwegian issue and partly because Preview has some context sensitive keys. In other words, Preview doesn't respond to certain keys if it isn't in the right context. This isn't a KM issue, it's an issue of understanding how Preview works.
Once the code works, we can try to address the timing. Your timing is 3 seconds, which is twice as long as mine.
So I wrote your program (hopefully no typos this time) and tested it. Everything seemed to work, but still 3 seconds.
Here is a video recording. Might seem a bit redundant to send you new ones, but why not if it can be of some help.
It's late over here, so will sleep.
Here is another screen recording. This time it actually shows that it zooms, but this time there are two voice actions.. I'm confused, but anyway.
EDIT: Might be my mac being overworked and slow right now