Applescript complaining about accessing and writing to a file
Applescript complaining about accessing and writing to a file
- Subject: Applescript complaining about accessing and writing to a file
- From: Paul Taylor <email@hidden>
- Date: Fri, 25 Oct 2013 10:57:10 +0100
I get the error message
25/10/2013 10:39:39.816 iTunes[3366]: AppleEvents/sandbox: Returning
errAEPrivilegeError/-10004 and denying dispatch of event rdwr/writ
from process 'AppleScript Editor'/0x0-0x24d24d, pid=12717, because
it is not entitled to send an AppleEvent to this process.
The errors message occurs every time we access the file /tmp/jaikoz_itunes_model.txt, so for the following lines
set fileref to open for access (thePath) with write permission (one message)
set eof fileref to 0
(one message)
write nextline & "\n" as "utf8" to fileref starting at eof (once per song in itunes)
close access fileref
(one message)
so the problem is not that we cant talk to itunes but that iTunes isn't allow to do things with the filesystem
It still writes to the file regardless but I think these error messages are slowing it down
Am I writing to the file in the wrong place or something ?
tell application "iTunes"
set thePath to (POSIX file "/tmp/jaikoz_itunes_model.txt")
set fileref to open for access (thePath) with write permission
set eof fileref to 0
set mainLibrary to library playlist 1
repeat with nexttrack in (get every track of mainLibrary)
if (class of nexttrack is file track) then
try
set trackname to name of nexttrack
set loc to location of nexttrack
set locpath to POSIX path of loc
set persistid to persistent ID of nexttrack
set nextline to trackname & "::" & locpath & "::" & persistid
write nextline & "\n" as "utf8" to fileref starting at eof
end try
end if
end repeat
close access fileref
end tell
return ""
Paul
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden