When creating or editing an Applescript with Script Debugger 8.0.4 I am unable to save a compiled Applescript (.scpt) file to my Google Drive. I am able to save compiled script bundles (.scptd) or compiled applications. Thought it was an access issue. SD has full disk access. I can save anywhere else on my Mac, just not .scpt on Google Drive. An interesting twist, Apple’s built in Script Editor has no issue saving .scpt files to Google Drive.
Unfortunately the error alert alone does not give any indication of the cause of the failure. Please check your Console log to see if any additional diagnostic information is recorded when you attempt to save your document. You can filter the Console log by application to isolate information logged by Script Debugger.
yes, it works without issue saving as text (.applescript). The issue only shows up with saving compiled applescript (.scpt). The issue is consistent with “Save”, “Save As”, “Save a Copy” and only when trying to save as a compile applescript (.scpt).
I opened a “BJs Coupons.scpt” file from Google Drive, made a simple edit and tried to save on Google Drive as the same filename. Here’s the log output with a few errors showing up. It’s showing an invalid filed descriptor argument and and extended attributes as invalid. Any ideas on what to try?
I cannot reproduce the problem you are experiencing here on my M1 Monterey 12.4 system. I installed Google Drive today and have been able to save without incident. I did have to grant access to Google Drive to some sort of helper application, but once that was done, it works as I would expect it to.
I retested saving scripts to iCloud Drive and here again I’m not experiencing problems you are seeing.
When I read through the console log message your posted, I thought at first that Google Drive was simple unable to handle files with resource forks, but that does not seem to be the problem as I can save without any problems.
We have had issues in the base where repeated saves of the same .scpt file can cause macOS’s security system to become involved and signal that a file cannot be saved. Generally, waiting “w while” (we’ve not been able to establish a specific time interval) allows the problem to clear. This is all happening within macOS, and Script Debugger is simply the messenger.
I am stumped. I hate to suggest a system reboot, but some file access issues have been resolved by reboots so you may want to try that. I would ensure that the following settings are in place before rebooting:
If the problem persists following a restart, please collect more Console log output. Hopefully something will appear that helps us identify where the failure is happening.
Thanks for the detailed response. Yes, I have done several reboots in this process and have verified the permissions. I unset/reset the permissions numerous times also. I also have the same issue between 2 different Mac systems.
I have however found what causes the issue I’m seeing. It thas to do with “Stream Files” from Google Drive. Once I set it to “Mirror Files” the error disappears and I can save .scpt files. So I do have a workable solution/workaround.
What puzzles me still is why I can save all other file formats from SD8, only the .scpt files are the ones that experienced the error.
Yes, that is a puzzle. The .scpt and .applescript file formats both use Resource Forks and extended attributes to store meta data relating to your script (window size, script description and other view settings). The actual script data is stored in the data fork. I would expect both file types to fail in the same way.
Google Drive only acts as a network volume if you configure it to load files on-demand (Streaming mode), which is the default mode for a fresh install or even an update (I think). If you instead use the “Mirror” option, then it’ll work like Dropbox, i.e. it’ll store its files in a local folder of your choosing. The mirror option is, as Pete has pointed out, the solution to this topic’s issue.
Curiously, though, saving to a regular SMB share (Synology NAS) with SD 8.0.4 in macOS 12.4 shows no issue here. So it seems that GDrive’s SMB server is at fault here.
I don’t think that “mirror mode” is the solution, more a good work around.
As stated in my initial post. Apple Script Editor application will save all file types (.scpt, .scptd, .applescript and .app) to Google drive in either “stream” or “mirror” mode. I only have this issue with SD8 in “stream mode”.
There is. The problem is that .scpt files are written using the Resource Manager, which is a very old hangover from pre-OS X days, and repeated calls to it in quick succession can trigger a permissions error. Script Editor dodges a lot of permission issues simply because Apple software is treated differently.
Is there anything important that absolutely must be stored in com.apple.ResourceFork, or would it be feasible to transition .scpt files to xattrs at some point like you did with .applescript?
I ask as an interested party, since iCloud Drive also doesn’t play well with com.apple.ResourceFork but handles other xattrs (as discussed in Allow QuickLook Preview to Pass Through iCloud). I imagine that this will continue to be an issue as cloud services become more & more ubiquitous.
The problem is the script’s description which is stored in the resource fork along with a few other settings. Moving to xattr would sacrifice interoperability with Apple’s Script Editor and any other runtime that presents the script’s description.
We’ve always endeavoured to avoid locking people into Script Debugger specific file formats.
if Apple ever makes the transition from resource fork to xattr for everything we will follow. Even if this happens, we’ll probably have to write both to ensure compatibility with old software.