无效的密钥形式applescript

时间:2012-11-21 02:17:12

标签: applescript

我在正在进行的程序中有以下代码

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

然后它继续,但每当我尝试编译它时它会给我以下错误

  

无效的密钥表单

任何帮助?

1 个答案:

答案 0 :(得分: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

OR

tell application "Finder"
    if exists POSIX file "/Users/student/Desktop/Accounts.txt" then
        beep
    else
        beep 2
    end if
end tell