2015-07-24 5 views
1

При использовании Applescript, чтобы записать файл на мой внешний жесткий диск и он показывает следующее сообщение об ошибке: The document “Untitled 2” could not be exported as “test.txt”. You don’t have permission. Мой код должен написать файл с помощью TextEdit и сохраните его в качестве .txt файла. Мой код:AppleScript Не имея разрешения на сохранение файлов

tell application "TextEdit" 
activate 
make new document 
set theDate to current date 
set text of document 1 to do shell script "curl 'www.google.com'" 
tell application "System Events" to tell process "TextEdit" 
    if menu item "Make Plain Text" of menu 1 of menu bar item "Format" of menu bar 1 exists then 
     keystroke "t" using {shift down, command down} 
     keystroke return 
    end if 
end tell 
save document 1 in "HARDRIVE:test.txt" 
end tell 

(HARDRIVE - мой внешний жесткий диск). Зачем возникает эта ошибка? Что я могу сделать, чтобы исправить это?

Благодаря

ответ

2

Используйте файловый объект как путь ->файл "некоторый HFS путь"

save document 1 in file "HARDRIVE:test.txt" 
Смежные вопросы