Hi, I have this code as part of an iChat auto-response script…
property comLib : missing value
property mediaLib : missing value
property utilsLib : missing value
set my scriptLoc to ":Library:Scripts:iChat:Script Plugins:"
set my comLib to load script file (my scriptLoc & "Communication.scpt")
set my mediaLib to load script file (my scriptLoc & "Media.scpt")
set my utilsLib to load script file (my scriptLoc & "Utilities.scpt")
on process(message)
if message contains "battery" then
set re to my utilsLib's batteryStat("MacBook Pro")
else if message contains "mail" then
set re to my comLib's unreadMail()
else
set re to "Command " & quoted form of message & " was not understood"
end if
return re
end process
using terms from application "iChat"
on message received theMessage from theBuddy for theChat
try
set theResponse to load(theMessage)
send theResponse to theBuddy
on error (errMsg)
send "Unfortunately, an error was encountered:" & return & errMsg to theBuddy
end try
end message received
end using terms from
… however, if I send a message to the iChat account that is hooked up to run this, I just get a message back saying “Unfortunately, an error was encountered:
comLib doesn’t understand the unreadMail message.” and I can’t understand why!
Inside Communication.scpt I have the unreadMail handler and if I comment out the iChat part of the original auto-response script (above), add in
display dialog "Command to test: " default answer ""
set theMessage to the text returned of the result
set theResponse to load(theMessage)
display dialog theResponse
and run it in script editor, it sort of works… I get an error from the “scriptLoc” part… the error I get is "error “Can’t make scriptLoc into type reference.” number -1700 from scriptLoc to reference
"
Any help would be appreciated!