Applescript issue after update

I’m stumped why the apps I created from Script Debugger no longer work?
The base script works. If I go to show contents of package and run the script, it works fine too.
When I run the app, I get an error “This script needs access to your calendars to run”, which I have given. Is there some other permissions that need to be tweaked?

All my app’s are like this now and I need a slap in the right direction to fix. I have an M1 Mac mini running MacOS 15.1.1. Any help would be most appreciated.

I have occasionally had issues with apps created by Script Debugger, paricularly when running them from a third party tool. I have also had to debug some Script Debugger problems by running scripts in Script Editor.
I have come to the conclusion that, while Script Debugger is my preferred development tool, the only apps I want are those created by the official Apple tool.

When I finish debugging a script in Script Debugger, I save it, select and copy all the text, and paste into Script Editor, compile and save it as an app.

I tried your suggestion using Applescript, and I get the same result. I can run as a standalone script fine, but I saved as an app and I get same error. I also did some poking around in the contents section of the package. I got it to work when I opened the terminal piece of the app. I had several of these scripts saved as bundles that worked for a few years and just recently something changed and I can’t figure out.

The usual cause of this is the app modifying the contents of the bundle when it runs. That used to happen with top-level variables, but at some point the OS solved this by adding suitable quarantine flags. You haven’t fiddled with the quarantine settings of the applets by any chance?

FWIW, both Script Editor and Script Debugger user identical methods to create applets; Script Debugger then does some extra processing. I’ve seen some examples where saving from Script Editor has fixed problems, and it appears to have been caused by the fact that the default ID Script Editor gives applets contains com.apple.

I recently did a clean install of Sequoia on my M2 Mac mini. I use a lot of AppleScript apps saved with Script Debugger and did not encounter any issues with permissions. So, I thought I would try to duplicate the circumstance described by the OP.

The following is my test script, which was saved to my Desktop as an app with Script Debugger:

--this script is run with the Calendar app open
--this script is saved as an "Application (Apple)" with Script Debugger 8.0.8

tell application "Calendar"
	set calendarName to "Test Calendar 3"
	set calendarDescription to "This is a test calendar"
	set newCalendar to make new calendar with properties {name:calendarName, description:calendarDescription}
end tell

I ran the script by double-clicking on it in a Finder window. I was asked for certain permissions, which I gave. I then checked in System Settings to insure that the AppleScript app had desired permissions:

From that point on, I was able to run the Make New Calendar AppleScript app without being prompted for permissions. However, if I changed and resaved the app, I was prompted for permissions, but this is to be expected. So, without additional information, it’s difficult to know why the OP’s apps are not working as he expects.

I have not messed with any of the package contents. All these issues started after an update to Sequoia.

I tried reinstalling Sequoia this AM with same results. When the app try’s to run it say’s it needs permission but I have given it.

I also tried to save as a script bundle and got the code signing error. Not sure what caused this but I’d like to figure it out. Thanks for any guidance along the way.



Apologies for an off-topic rant, but this dialog is a reminder of how idiotic macOS alerts look, and how hard it is to read and understand them, after they were disfigured on Big Sur:

Macs now have the ugliest alerts in the entire computer world.

I still hope that more and more developers will use custom alert classes that restore the normal pre-Big Sur NSAlert design.

The usual causes of that dialog are either something locked in the bundle or a permissions issue. As part of the code-signing process, all extended attributes are removed (using xattr), and this will fail of Script Debugger doesn’t have permission or a file is locked.

If you want to send me a sample file, I’d be happy to look at the issue.

Sure thing Shane, I appreciate your help. Here’s my script:

use script "CalendarLib EC" version "1.1.3" -- put this at the top of your scripts
use scripting additions

--Put into production on 03/11/2022.

set calendarName to "Mike"

set status to "confirmed"

set theLocationList to {"Gastro: Dr. A", "Pulmonary: Dr. B", "Eurologist: Dr. C "}

set theLocationList to simple_sort(theLocationList)


set locationChoice to (choose from list theLocationList) -- Returns a list — or 'false' if the "Cancel" button's clicked.
if (locationChoice is false) then error number -128 -- Explicit "Cancel" error.
set theLocation to item 1 of locationChoice -- Otherwise get the single item of text from the list.

-- Handler(s).

on simple_sort(my_list)
	set the index_list to {}
	set the sorted_list to {}
	repeat (the number of items in my_list) times
		set the low_item to ""
		repeat with i from 1 to (number of items in my_list)
			if i is not in the index_list then
				set this_item to item i of my_list as text
				if the low_item is "" then
					set the low_item to this_item
					set the low_item_index to i
				else if this_item comes before the low_item then
					set the low_item to this_item
					set the low_item_index to i
				end if
			end if
		end repeat
		set the end of sorted_list to the low_item
		set the end of the index_list to the low_item_index
	end repeat
	return the sorted_list
end simple_sort


set DRData to date ((display dialog "New Appointment Info in format MM DD, yyyy hh:mm:ss AM or PM" default answer "11 21 2024 11:00:00 AM " with title "Enter New Dr Appointment" buttons {"Cancel", "Continue"} default button "Continue")'s text returned)

set Comments to (display dialog "Comments For This visit" default answer " " with title "Enter Comments Here " buttons {"Cancel", "Continue"} default button "Continue")'s text returned


--Set alarm
display dialog "Set first alarm; how much time before event?" default answer "7" buttons {"minutes", "hours", "days"} default button 2
set {text returned:theText, button returned:theButton} to result

try
	set theNumber to theText as number
	if theButton is "days" then
		set alarmTime to theNumber * -60 * 24
	else if theButton is "hours" then
		set alarmTime to theNumber * -60
	else -- if theButton is "minutes" then
		set alarmTime to theNumber
	end if
on error
	set alarmTime to 0 -- in case of error it wasn't defined
end try

--Set alarm 2
display dialog "Set second alarm; how much time before event?" default answer "7" buttons {"minutes", "hours", "days"} default button 3
set {text returned:theText2, button returned:theButton2} to result
try
	set theNumber2 to theText2 as number
	if theButton2 is "days" then
		set alarmTime2 to theNumber2 * -60 * 24
	else if theButton2 is "hours" then
		set alarmTime2 to theNumber2 * -60
	else -- if theButton2 is "minutes" then
		set alarmTime2 to theNumber2
	end if
on error
	set alarmTime2 to 0 -- in case of error it wasn't defined
end try
tell application "Calendar"
	activate
	try
		set newEvent to make new event at end of events of calendar calendarName with properties {summary:"Dr Appoinment", start date:DRData, end date:(DRData + 1800), location:theLocation}
		make new sound alarm at end of sound alarms of newEvent with properties {trigger interval:alarmTime, sound name:"Sosumi"}
		make new sound alarm at end of sound alarms of newEvent with properties {trigger interval:alarmTime2, sound name:"Sosumi"}
	end try
	try -- ADDED
		close calendar theCal with saving -- ADDED
		--or -- ADDED
		save calendar theCal -- ADDED
	end try
end tell




The script as written works when I run it, the issue is with creating an app. Thanks…

I don’t think the issue is with the script itself but rather with the extended attributes of the files as saved on your Mac. To have any hope of confirming that, I’d need you to zip a copy of the applet and email it to me.

Shane solved the problem. I had the app folder tied to my iCloud account. I moved the apps to a new location (not iCloud) and they worked.

I used to run these app’s from my desktop folder that was tied to my iCloud account and until very recently, they worked as designed. Want to thank all for trying to help.

1 Like