| |
| | |

Apple Phoon Forum

 Forgot password?
 Register
View: 484|Reply: 2

Replace characters in chat text

[Copy link]

Post time: 2014-01-10 07:07:07 |Show all posts
AppleScript
I was written a small applescript to replace some characters in chat message. Here is my code.
property searchList : {"live"}property replaceList : {"love"}to switchText of t from s to r set text item delimiters to s set t to t's text items set text item delimiters to r tell t to set t to beginning & ({""} & rest) tend switchTextto convertText(t) set d to text item delimiters considering case repeat with n from 1 to count searchList set t to switchText of t from my searchList's item n to my replaceList's item n end repeat end considering set text item delimiters to d tend convertTextusing terms from application "Messages"  on message sent theMessage for theChat try return convertText(theMessage) end try end message sent  on message received theMessage from theBuddy for theChat return convertText(theMessage) end message received  on chat room message received theMessage from theBuddy for theChat return convertText(theMessage) end chat room message received end using terms from
This code worked fine for Yahoo account, but it dont work when i received messages from iMessage and Jabber account. I tried to look into Alerts event and i found "Message received in active chat" ,maybe iMessage and Jabber account use this event to alert received message, but the problem is this object not defined in applescript. How can i define it, or make this code work with iMessage and Jabber account.
        Mac mini, OS X Mountain Lion (10.8.2)
Reply

Use magic Report

Post time: 2014-01-10 09:45:13 |Show all posts
after long long times for google and test myseft, i found yahoo account have problem too, because active chat [i] why is apple dont define this object ""Message received in active chat"'
Reply

Use magic Report

Post time: 2014-01-10 08:14:47 |Show all posts
...
oh sorry i was wrong, active chat just a chat in active, does not seem to have any effect to received message, but i dont know why iMessage and Jabber dont work with "on message received" .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Archive| Apple Phoon

2021-04-18 06:38 GMT-8 , Processed in 0.066592 sec., 27 queries .

Powered by Discuz! 7.2

Release 20121101, © 2001-2021

To Top