2016-10-06 5 views
1

나는 문서를 열고 텍스트 상자에 입력 한 내용을 문서에 추가 한 다음 경로에 저장하는 appescript를 만들려고합니다. 저장하려고하면 "파일이 없기 때문에 x를 저장할 수 없습니다."라고 표시됩니다.applescript 주소록 만들기

여기에 내 코드

display dialog "username" default answer "" 
 
set the target_username to the text returned of the result 
 
display dialog "password" default answer "" with hidden answer 
 
set the pass to the text returned of the result 
 
if target_username is "Plasma" and pass is "Sship" then 
 
    display dialog "Welcome! Please select a function!" buttons {"Add address", "View address"} 
 
    if button returned of result is "Add address" then 
 
     set booka to text returned of (display dialog "rers!" default answer "") 
 
     tell application "TextEdit" 
 
      activate 
 
      make new document 
 
      set text of document 1 to booka 
 

 
      delay 10 
 
      set thePath to "/Users/Cameron/Desktop/" 
 
      set thedoc to document 1 
 
      set thetitle to "food" 
 
      save thedoc in (thePath & thetitle) 
 
     end tell 
 
    else 
 
     display dialog "no" 
 
    end if 
 
else 
 
    display dialog "no" 
 
end if 
 
}

답변

0

txt 파일로 저장할 수 있습니다 노호 스크립트입니다.

set booka to "my string" -- set booka variable just for testing ! 
tell application "TextEdit" 
activate 
make new document 
set text of document 1 to booka 
set thePath to "Users:Cameron:Desktop:food.txt" 
tell document 1 to save in file thePath 
end tell 
+0

그것은 여전히 ​​나던 작품은, 그것은 나에게 – PLASMAGHOST

+0

스크립트는 물론 자신의 사용자 이름으로 '카메론'대체 나를 위해 노력하고 같은 오류를 제공합니다. 귀하의 사용자가 '카메론'입니까? (그게 내가 테스트 할 수없는 유일한 것) – pbell

+0

괜찮 았어 고마워! – PLASMAGHOST