Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11

Calendar.app not running Apple Script Applications at time.

I have a bunch of Apple Scripts (AS) saved as Applications that get triggered by Calendar. Several refuse to run at the time of the alarm, others run fine. I might have an event at 10.30 that urns fine and one at 10.40 that does not.

The ones that did not run I created new from scratch in the hope this would solve the problem as AS is sometimes picky with the new security rules.

Does anybody have an idea as to why this is happening or how to fix this? Hope so. Thanks.

Some screen shots.
 

Attachments

  • Screenshot 2021-10-11 at 10.52.03.png
    Screenshot 2021-10-11 at 10.52.03.png
    19.6 KB · Views: 180
  • Screenshot 2021-10-11 at 11.04.16.png
    Screenshot 2021-10-11 at 11.04.16.png
    22.4 KB · Views: 125
  • Screenshot 2021-10-11 at 11.06.20.png
    Screenshot 2021-10-11 at 11.06.20.png
    26.1 KB · Views: 116
  • Screenshot 2021-10-11 at 11.06.44.png
    Screenshot 2021-10-11 at 11.06.44.png
    28.5 KB · Views: 119

kryten2

macrumors 65816
Mar 17, 2012
1,115
99
Belgium
Try giving your Apple Script Application Full Disk Access. Check logs with the Console application. Try running your scripts/apps with launchd and a launchagent.
 

barbu

macrumors 65816
Jul 8, 2013
1,263
1,052
wpg.mb.ca
Something I’ve done in the past to make this work is make the automation go thru bash/zsh and call the AppleScript that way. Totally janky but it works.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
Try giving your Apple Script Application Full Disk Access. Check logs with the Console application. Try running your scripts/apps with launchd and a launchagent.
it has all the access it can have including full disk access.

Found no clue in the logs.

as to launchd and a launchagent I know about them but would not know how to set those up. Is there a GUI for that? Because I would not know how to do this. There used to be one for Cron (Cronix), but that depreciated.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
Something I’ve done in the past to make this work is make the automation go thru bash/zsh and call the AppleScript that way. Totally janky but it works.
OK, I understand what you say. however do not know how to do this. could you post an example of how you do this, using my script above? Thanks.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
thanks barbu, reading it I do not see how it helps me. is it saying I should use osascript? the linked page seems very limited in what it communicates.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
What seems to be part of the challenge is that it looks like the machine goes in to a kind of sleep stat, and that seems to be when the errors occur. Could that be?
 

posguy99

macrumors 68020
Nov 3, 2004
2,284
1,531
I have a bunch of Apple Scripts (AS) saved as Applications that get triggered by Calendar. Several refuse to run at the time of the alarm, others run fine. I might have an event at 10.30 that urns fine and one at 10.40 that does not.
I'd wonder if the scripts need Assistive Access. If you make something simple, that doesn't try to talk to the GUI but say, just touches a file somewhere. Does that one always run? That script name in your screenshot makes me think it is supposed to interact with the GUI.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
yes the scripts all send emails. some just send a plain email some with a file as attachment. But even simple things like opening an application sometimes fail.

what do you mean with Assistive Access?
 

nothingtoseehere

macrumors 6502
Jun 3, 2020
455
522
From the small pictures and without the source code, diagnosis is difficult.
For me, under Big Sur scripts and apps have more problems than before, i.e. with Mojave. Random errors, once given authorizations disappear.
As much as I love Macrumors, here maybe macscripter.net may be a better place, with the great people of Script Debugger around.
 
  • Like
Reactions: barbu

LARoussel

macrumors newbie
Oct 22, 2021
2
2
I have had difficulty with calendar triggering events when the event has a . in the name. I had to change that to _ to make it work. Perhaps the + sign in your script name is preventing calendar from recognizing and triggering it.
LARi
 
  • Like
Reactions: barbu

barbu

macrumors 65816
Jul 8, 2013
1,263
1,052
wpg.mb.ca
I have had difficulty with calendar triggering events when the event has a . in the name. I had to change that to _ to make it work. Perhaps the + sign in your script name is preventing calendar from recognizing and triggering it.
LARi
That’s an excellent point, might be choking on the name.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
I have had difficulty with calendar triggering events when the event has a . in the name. I had to change that to _ to make it work. Perhaps the + sign in your script name is preventing calendar from recognizing and triggering it.
LARi
OK thanks. I have had this in the past long ago somewhere, will give it a go when back at the machine later today. Is a known Windooz problem not a Mac problem up to now, it had crossed my mind and I forgot it again.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
I have had difficulty with calendar triggering events when the event has a . in the name. I had to change that to _ to make it work. Perhaps the + sign in your script name is preventing calendar from recognizing and triggering it.
LARi
I have other scripts and they too do not trigger. but thanks for the suggestion.
 

Change Agent

macrumors regular
Original poster
Oct 24, 2018
151
11
From the small pictures and without the source code, diagnosis is difficult.
For me, under Big Sur scripts and apps have more problems than before, i.e. with Mojave. Random errors, once given authorizations disappear.
As much as I love Macrumors, here maybe macscripter.net may be a better place, with the great people of Script Debugger around.

I understand. I am also suspecting that it is OS11. And Apple never gives support on Apple Scripts. I tried to get info if there are tricks or things to observe in general to no avail.

Here a sample of a code (a simple one) that also does not run. Normally the message after the Ping part and the OK are not there, I added those for testing.

-- check if network is up

repeat
try
set pingRequest to do shell script "/sbin/ping -c6 google.com"
if pingRequest contains "0% packet loss" then exit repeat -- This will run the ping until there's no packet loss.
on error
beep
delay 10
end try
end
repeat
display dialog
"Finished checking - Network is up and running" buttons {"OK"} default button "OK" giving up after 6
delay 3
say "OK"
-- end

set theBody to "Text"
set theSubject to "Text"
set theTarget to "<name@yahoo.com>"
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody}
tell newMessage
make new to recipient at end of to recipients with properties {address:theTarget}
set sender to "<sender@yahoo.com>"
end tell
send newMessage
end tell

delay
2
tell application "System Events"
set visible of (every process whose visible is true) to false
set visible of process "Finder" to true
end tell


Now I have also tested this with a timeout of 3600 and that makes not difference either.

Suggestions anybody?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.