AppleScript is not working

Hi!


So I had intended to start learning basic AppleScript, but I soon realised that AppleScript wasn't working at all.

I first noticed it when running Script Cues in Qlab. These had been written by other people and posted online, so they should've worked.


Then, I opened Script Editor and tried to write a simple Script, but once again, nothing happened.

Script Editor won't let me run or compile any scripts, and I can't record actions or save a file. The Script language selection menu in the Preferences is blank. I'll attach some screenshots.

Something similar happens with Automator. If I try to run AppleScript from there I always get a "Syntax Error" message.


I've tried everything that's been mentioned in these two threads:

Script Editor idle, with missing features - Apple Community

Script Editor app and Applescripts not wo… - Apple Community

But nothing seems to do the trick.


I've tried to:

  • Update from Monterey to Ventura.
  • Reinstall the OS.
  • Delete the com.apple.ScriptEditor2.plist file
  • Boot into Safe Mode. The issue persists.
  • Remove all login items.


The issue is only present with my User. I've created a test user and everything works fine. Something in my setup must be interfering with it.


I've also run Malwarebytes, and everything seems to be alright.


Here's my Etrecheck report:



And some screenshots:




If anyone has any idea how to fix this, I'd be so grateful. It's driving me mad!

Many thanks in advance.

MacBook Pro 15″, macOS 13.6

Posted on Dec 27, 2023 4:56 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 28, 2023 3:36 PM

Okay, guys, I think I finally solved this, but I might need someone to tell me why I had this issue, because I have no idea.


So, I found this post on a forum, which talked about "AppleScript and Javascript components not missing". So I thought that maybe I was missing those components.


I don't know if this is normal, but in my Finder I found two different libraries:


  • (1) Macintosh HD > Library
  • (2) Macintosh HD > System > Library


Both had a Components folder, but the one on (1) was empty.

After copying the AppleScript.component folder from (2) to (1) and relaunching Script Editor, it worked.


This leads me to believe that my User's Script Editor was looking for the components in (1) whereas my Test Account's Script Editor was looking for them in (2).


I have no clue why this is. I'm happy that I can now use AppleScripts and I'm looking forward to learning more about them... I'm definitely off to a rocky start!

Similar questions

9 replies
Question marked as Top-ranking reply

Dec 28, 2023 3:36 PM in response to Perrypijuz

Okay, guys, I think I finally solved this, but I might need someone to tell me why I had this issue, because I have no idea.


So, I found this post on a forum, which talked about "AppleScript and Javascript components not missing". So I thought that maybe I was missing those components.


I don't know if this is normal, but in my Finder I found two different libraries:


  • (1) Macintosh HD > Library
  • (2) Macintosh HD > System > Library


Both had a Components folder, but the one on (1) was empty.

After copying the AppleScript.component folder from (2) to (1) and relaunching Script Editor, it worked.


This leads me to believe that my User's Script Editor was looking for the components in (1) whereas my Test Account's Script Editor was looking for them in (2).


I have no clue why this is. I'm happy that I can now use AppleScripts and I'm looking forward to learning more about them... I'm definitely off to a rocky start!

Dec 28, 2023 10:17 AM in response to Perrypijuz

I see you have PACE Anti-Piracy installed. First, there is no reason to ever install or run any 3rd party "cleaning", "optimizing", "speed-up", anti-virus, VPN or security apps on your Mac.  This documents describe what you need to know and do in order to protect your Mac: Effective defenses against malware and other threats - Apple Community and Recognize and avoid phishing messages, phony support calls, and other scams - Apple Support.  


There are no known viruses, i.e. self propagating, for Macs.  There are, however, adware and malware which require the user to install although unwittingly most of the time thru sneaky links, etc.   


Anti Virus developers try to group all types as viruses into their ad campaigns of fear.  They do a poor job of the detecting and isolating the adware and malware.  Since there are no viruses these apps use up a lot of system resources searching for what is non-existent and adversely affect system and app performance.


There is one app, Malwarebytes, which was developed by a long time contributor to these forums and a highly respected member of the computer security community, that is designed solely to seek out adware and known malware and remove it.  The free version is more than adequate for most users.  


I don't know if the PACE software is related to your problem but it sure isn't needed. It can only hinder system performance. Uninstall it according to the developer's instructions. You can check to see if you've removed all of the supporting files by downloading and running the shareware app Find Any File to search for any files with the application's or the developer's name in the file name.  For the PACE software you'd do the following search(es): 


1 - Name contains pace


Any files that are found can be dragged from the search results window to the Desktop or Trash bin in the Dock for deletion.


FAF can search areas that Spotlight can't like invisible folders, system folders and packages.  


If you get warnings that the file can't be deleted because it is in use or used by another app boot into Safe Mode according to How to use safe mode on your Mac and delete from there.


Note:  if you have a wireless keyboard with rechargeable batteries connect it with its charging cable before booting into Safe Mode.  This makes it act as a wired keyboard as will assure a successful boot into Safe Mode.



Dec 27, 2023 3:38 PM in response to Perrypijuz

Since AppleScript works fine in another user account your account must have some settings or 3rd party software that is interfering with AS.


Download and run Etrecheck. Be sure to give it Full Disk access before running.



Copy and paste the results into your reply. Etrecheck is a diagnostic tool that was developed by one of the most respected users here in the ASC and recommended by Apple Support  to provide a snapshot of the system and help identify the more obvious culprits that can adversely affect a Mac's performance.


Copy the report


and use the Additional Text button to paste the report in your reply.



Then we can evaluate the report to see if we can determine the cause of the problem.


Dec 27, 2023 1:53 PM in response to Perrypijuz

If Safe Mode did not help, but a new macOS user account works fine, then it must be some sort of setting within your main macOS user account that is the problem since Safe Mode also prevents Login Items from launching automatically, so it indicates a configuration issue or a corrupt configuration file. I guess there could possibly be a permissions issue of some sort.


Unfortunately I won't be able to help much more than giving this insight since I have only used these items a few times a long time ago. Hopefully another more knowledgeable contributor will chime in to further assist you.

Dec 27, 2023 2:27 PM in response to Perrypijuz

I've tried everything that's been mentioned in these two threads:


The author of the second thread described removing the entire ~/Library/Application Support folder. Removing that folder's entire contents is complete overkill but you might try removing certain items likely to be related to using AppleScript. ~/Library/Application Support/Automator could be one but I think I would have remembered it.


Nevertheless examining the contents of ~/Library/Application Support is a useful suggestion along the same lines.


As for ~/Library/Caches... maybe, but I doubt it.


The other thread you mentioned muddied the waters with the presence of well-known scam products.

Dec 27, 2023 2:06 PM in response to Perrypijuz

I experienced a very similar if not identical problem, and did more or less everything you did in an effort to fix it. Attempting to compile a script caused the Script Editor app to become unresponsive requiring a force quit.


The change in behaviour was coincident with a macOS upgrade, or perhaps it was an update. Nothing else was changed; Script Editor just stopped working.


Something in my setup must be interfering with it.


Correct. Eventually I found something amiss with the files AppleScript was using, but I no longer recall exactly what it was. It was something simple though.


Try changing where your scripts are saved.


It's not malware.

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 is not working

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