I want to write a code for custom rule.I want to that when some one post a comment then one can able to like his/her post or comment i.e a single click on the Like will 'like' pieces of content and a message is send to that user who posted that comment . Is it possible with rules ??
You can use flag module.
Def: Flag is a flexible flagging system that is completely customizable by the administrator. Using this module, the site administrator can provide any number of flags for nodes, comments, users, and any other type of entity.
Once you install the module, its very simple. Goto structure->flag->add new flag. Give title for the flag and use the count option to display the like-count.
In my example, 'Node Like' is the title of the flag, the flag count can be achieved in token
To answer your question, its possible but complex to achieve just using rules.