AppleScript File not open with write permission error

I have an applescript that works perfectly on my local machine. It opens the file and writes to it and then closes. My Applescript is being tested and saved as a .app so it is an application. When I put the application on my server to test out the user experience it never propely opens the file and gives me this error:


"File not open with write permission.

Finder got an error: File not open with write permission. (-61)"

Why would this work on my local machine and not work after being downloaded from my server? I have tested that my path's are correct and like I mentioned everything works perfectly on my local MAC machine. Here is the section of my Applescript code that seems to be throwing the error:

set motionFullPath to ("" & pathEffects & "" & effectPlugin & ":" & theFolders & ":" & motionFiles & "") as string

  set myFile to open for access file motionFullPath with write permission
  set endOfFile to (get eof myFile) as number
  if result > 0 then
  set theText to read myFile
  set eof myFile to endOfFile
  write "<!--uuid:" & theURL & "-->" & return & theText to myFile
  end if
  close access myFile

Replies

Well I came across the issue which is that my .app is quarantined. But I am super confused how can my .app be properly codesigned and yet still be quarantined by Apple? I have an app called iTest.app that I downloaded from my server and made sure that it was codesigned correctly but yet it is still quarantined? I thought that having a valid code signature was the whole point of getting past Gatekeeper?



MyMac-7:Downloads user$ ls -l@ iTest.app

total 0

drwxr-xr-x@ 7 user staff 238 Apr 21 08:05 Contents

com.apple.quarantine 67


MyiMac-7:Downloads user$ codesign --verify --deep --strict -vvvvvvv iTest.app

iTest.app: valid on disk

iTest.app: satisfies its Designated Requirement


MyiMac-7:Downloads user$ spctl -a -t exec -vvvvvvv iTest.app

iTest.app: accepted

source=Developer ID

origin=Developer ID Application: myID

To remove the quarantine tag, use the xattr -d com. apple. quarantine command on the quarantined file.