if theMessage starts with "shell " then
set textReturned to (do shell script (text (offset of "shell " in theMessage) thru end of theMessage))
send textReturned to theBuddy
But I’m getting this error:
Event: Message Received
File: ICHAT.scpt
Error: sh: shell: command not found
Your script would effectively give unauthorized, unrestricted shell access to anyone that knows the secret (i.e. put "shell " before some IM directed your way).
That aside, offset of x in y returns the offset in y where xstarts. Your code seems to expect that it returns the offset after the end of x. As a hint, there is no need for offset of here since your code can already determine the offset and length of the target string.
Well I accually made the iChat account on the computer secure so only autherized buddys can send ims to it. In addition, it won’t accept the chat unless it’s from me. It denies others.