3

私が取り組んでいるプログラムに次のコードがあります

set outPath to "/Users/student/Desktop/Accounts.txt"
set x to text returned of (display dialog "Username" default answer "")
set y to text returned of (display dialog "Password" default answer "")
set RAccounts to (read POSIX file "/Users/student/Desktop/Accounts.txt")
if file path outPath exists
then 
get word 1 
else

そしてそれは続きます、しかし私がそれをコンパイルしようとするときはいつでもそれは私に次のエラーを与えます

無効なキーフォーム

何か助けはありますか?

4

1 に答える 1

1

試す:

set outPath to "/Users/student/Desktop/Accounts.txt"
set x to text returned of (display dialog "Username" default answer "")
set y to text returned of (display dialog "Password" default answer "")
try
    set RAccounts to read POSIX file outPath
on error
    -- file outPath does not exist … do things
end try

また

tell application "Finder"
    if exists POSIX file "/Users/student/Desktop/Accounts.txt" then
        beep
    else
        beep 2
    end if
end tell
于 2012-11-21T02:34:18.687 に答える