AppleScript Keystroke does not work correctly after migrating to M2

Hi,

I've got a new MacBook Air M2 two weeks ago and have migrated my MacBook Pro 2019 to the new MacBook Air M2. Both MacBooks are on Venture 13.1.


I'm using a small AppleScript as Service with a shortcut SHIFT-CMD-D to insert the current date and time in Notes.


on run {input, parameters}
	set dateString to do shell script "date +'%Y-%m-%d %k:%M'"
	tell application "System Events"
		keystroke dateString
	end tell
	return input
end run


That has inserted this line in the past and is still working on the MacBook Pro:


2023-01-11  8:00


On the MacBook Air M2 it add a dot behind the day and if you press SHIFT-CMD-D more then once it starts to reformat the entire text instead of adding another date / time string.


2023-01-11. 8:00


The reformat also happens sometimes if you press SHIFT-CMD-D the first time in a note.


As said, exactly the same AppleScript still works with no problem one the MacBook Pro in the same note in Notes.


I hope that someone has an idea how to fix it, as I'm suing this each day when making notes in meetings.


Regards, Carsten



MacBook Air, macOS 13.1

Posted on Jan 10, 2023 11:17 PM

Reply
Question marked as Top-ranking reply

Posted on Jan 11, 2023 4:27 AM

Hi Luis,


yes, it seems that it works on Intel MacBooks. It's working on my MBP 13" as well.

The problem appears only on the MacBook Air with M2 processor.


If I use the services menu it works, but that is not how one would like to work.

I have changed the keyboard shortcut already to several other shortcuts, but the problem stays the same.


With "reformat the entire text" I means, that it seems that the keyboard shortcut does not start the service that is associated, but it uses other shortcuts in the Notes App to change the size of the text (SHIFT-CMD-. ), or to add bullet points (SHIFT-CMD-7), etc.

Similar questions

5 replies
Question marked as Top-ranking reply

Jan 11, 2023 4:27 AM in response to Luis Sequeira1

Hi Luis,


yes, it seems that it works on Intel MacBooks. It's working on my MBP 13" as well.

The problem appears only on the MacBook Air with M2 processor.


If I use the services menu it works, but that is not how one would like to work.

I have changed the keyboard shortcut already to several other shortcuts, but the problem stays the same.


With "reformat the entire text" I means, that it seems that the keyboard shortcut does not start the service that is associated, but it uses other shortcuts in the Notes App to change the size of the text (SHIFT-CMD-. ), or to add bullet points (SHIFT-CMD-7), etc.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript Keystroke does not work correctly after migrating to M2

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.