SOLVED!
Hehe this is the second post now that I have solved on my own in just a matter of a few minutes after posting on here for help. At the end of my AIO Parser I added a straight up else statement. So If I type something in there and it doesn’t match the first IF/Then’s it goes to a MultiWord Parser and then does a search of theMessage for keywords like Google or whatever and then splits the command starting from the " " space between google and the next part. The code that does it is the following:
on MultiCommand(theMessage)
try
if theMessage contains "Google" then
set searchWord to text ((offset of " " in theMessage) + 1) thru -1 of theMessage
set theResponse to searchWord
end if
end try
return theResponse
end MultiCommand
==Old Post Starts Here==
As of right now I have a script that takes the ichat message and runs it through a bunch of if then else statements. I was thinking it would be very useful to beable to pass 2 command through ichat to the applescript. E.G. “Google meatloaf”. Applescript would reckgonize Google and then use the second half to actually search.
This gets the message and passes it on
on message received theMessage from theBuddy for theChat
-- run the AIO parser.
set theResponse to AIOControls(theMessage)
-- send back the response.
send theResponse to theChat
end message received
and this is part of the parser
on AIOControls(theMessage)
try
global weather_loc
set weather_loc to "~/Desktop/weather.py"
global weather_ac
set weather_ac to "48413"
set theResponse to "Invalid command."
if theMessage is "status" then
set theResponse to getCurrentiTunesTrack()
else if theMessage is "next" then
tell application "iTunes"
next track
end tell
set theResponse to "Playing next track. " & getCurrentiTunesTrack()
How can I have it recognize just the first part with a system like this?