FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

[MSN] --> (possible solution to be able to chat using phone)
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows
View previous topic :: View next topic  

Is it workable?
Yes!
20%
 20%  [ 1 ]
No!
40%
 40%  [ 2 ]
Will give it a try!
40%
 40%  [ 2 ]
Total Votes : 5

Author Message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Sat Jul 21, 2007 10:41 pm    Post subject: Reply with quote

yeah, I forgot to mention you have to rewrite that line. also, I have made a new script which uses the msn-plus-script phatez modified, along with a few minor modifications from me. I will be releasing it shortly:D
Back to top
View user's profile Send private message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Sun Jul 22, 2007 12:40 am    Post subject: Reply with quote

well, here it is. It now works like a charm. It is able to both recieve messages and send them(only need somebody to make a msn-plus-script for retrieving the message from the textfile in which my script stores the messages to be sent) It supports multiple messages from both the same person and from different persons. Whenever a message is recieved, you get question whether to answer it or not(well, it really just shows you the message and you can press Yes/No) and if you answer yes, you will be taken to the write-a-message-screen. Currently, It got a little bug though. Wouldn't be a problem fixing it really. Just don't know all this about salling-event-names. If a message is recieved, you will be asked whether or not to answer, and if you choose no, it will just continue to ask again and again on the same message, becouse I don't know how to set a function to when the user presses no. Salling, please help me with this. Other than that, its pretty much goood:)

now, if somebody could write a msn-plus-script which stores all the online contacts(e-mail, nickname and their status) in a textfile that would be great.

Also, I think we would need the e-mail adress of the person who sent a message to be stored along with the current message-file.

here is the msg-plus-script I used:
[code:1]//Global Variables
var fsObj = new ActiveXObject("Scripting.FileSystemObject");

//Functions
function AddLineToFile (file, line) {
if (!fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file))
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 1);
else
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 8, 0);
fileObj.WriteLine(line);
fileObj.Close();

}
function ReadFile (file) {
var ForReading = 1, ForWriting = 2;
f = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, ForReading);
r = f.ReadAll();
return(r);
}

function OnEvent_Initialize(MessengerStart) {
fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + "salling_log.txt", 2, 1);
}

///////Take note this part. Most impt.//////////////////////////
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
if(Origin != Messenger.MyName)
{
var d = new Date();
hour = d.getHours();
min = d.getMinutes();
sec = d.getSeconds();
time = hour+":"+min+":"+sec;
var RecMessage = "<time>"+time+"</time>"+"<who>" + Origin + "</who>" + "<message>"+Message+"</message>" ;
AddLineToFile("salling_log.txt", RecMessage);
var a = ReadFile("salling_log.txt");
if (a.substr(0 , 7) == "<Reply>")
ChatWnd.SendMessage(a);

}
}
///////////////////////////////////////////////////////////////////////



function OnEvent_Uninitialize(MessengerExit) {
fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + "salling_log.txt", 2, 1);
}[/code:1]

It is mostly the same as the one phatez gave us, only some formatting of how the messages should be stored has changed. Need the e-mail-adress of the person who sent the message to be stored here to, we need it for when we are going to send a message back.



MSN Messenger.zip
 Description:
MSN messenger for salling v.0.3

Download
 Filename:  MSN Messenger.zip
 Filesize:  1.6 KB
 Downloaded:  667 Time(s)

Back to top
View user's profile Send private message
phatez
Junior Member


Joined: 07 Jun 2007
Posts: 49

PostPosted: Sun Jul 22, 2007 10:58 am    Post subject: Reply with quote

I modified some lines.
The format to be saved will be <handle></handle><time></time><who></who><what></what>
Handle is used to determine which chat window.
<br>
And format to be save in the sendmessage is <handle></handle><what></what>
<br>
One last thing, i dunno where to put the sendmsg function.

[code:1]//Global Variables
var fsObj = new ActiveXObject("Scripting.FileSystemObject");
var handle;
var what;

//Functions
function AddLineToFile (file, line) {
if (!fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file))
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 1);
else
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 8, 0);
fileObj.WriteLine(line);
fileObj.Close();

}
function ReadFile (file) {
var ForReading = 1, ForWriting = 2;
f = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, ForReading);
r = f.ReadAll();
return(r);
}

function convertLine(line)
{
handle = line.substr(line.lastIndexOf("<handle>")+8,line.lastIndexOf("</handle>")-8);
what = line.substr(line.lastIndexOf("<message>")+9,line.lastIndexOf("</message>")-line.lastIndexOf("<message>")-9);
}

function OnEvent_Initialize(MessengerStart) {
fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + "salling_log.txt", 2, 1);
}

///////Take note this part. Most impt.//////////////////////////
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
if(Origin != Messenger.MyName)
{
var d = new Date();
hour = d.getHours();
min = d.getMinutes();
sec = d.getSeconds();
time = hour+":"+min+":"+sec;
var RecMessage = "<handle>"+ChatWnd.Handle+"</handle>"+"<time>"+time+"</time>"+"<who>" + Origin + "</who>" + "<message>"+Message+"</message>" ;
AddLineToFile("salling_log.txt", RecMessage);




}
}
///////////////////////////////////////////////////////////////////////

function sendmsg() {
var a = ReadFile("salling_log.txt");
convertLine(a);
Debug.Trace("Currently opened chat windows:");
var Windows = Messenger.CurrentChats;
var e = new Enumerator(Windows);
for(; !e.atEnd(); e.moveNext())
{
var ChatWindow = e.item();
if (handle == ChatWindow.Handle())
ChatWindow.SendMessage(what);
Debug.Trace(" Handle: " + ChatWindow.Handle);
}
}

function OnEvent_Uninitialize(MessengerExit) {
fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + "salling_log.txt", 2, 1);[/code:1]
Back to top
View user's profile Send private message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Sun Jul 22, 2007 2:01 pm    Post subject: Reply with quote

hmm... I don't know if that method for sending messages would be the best really. The way I see it(haven't really tested your script though) is that the msn-script is ls looking into the the textfile every now and then and if it finds a message to be sent then it will open up a chatwindow and sending the message through there? I'm just thinking that if I am doing something else on my computer at that time, like wathing a movie, wouldn't that chat-window pop right in front of the movie? that would be really annoying. ain't msn-plus capable of sending messages without opening chat-windows? anyways, if you are sure there is no other way, just keep going.

and one other thing, my salling clicker stores the messages sent in another textfile, called send.txt

Also, to make my script work. you must edit the two first lines in my script which holds the location of the log-files. Hope it works good for all of you.
Back to top
View user's profile Send private message
phatez
Junior Member


Joined: 07 Jun 2007
Posts: 49

PostPosted: Sun Jul 22, 2007 5:55 pm    Post subject: Reply with quote

I think this is a working version le.

Extract msn folder to My Clicker Scripts and <salling folder> to <msn live scripts folder>

There are few bugs not solve yet. But decide to release it first cuz do not have time for it also le. The user must reply in 5 secs after he received a msg, otherwise his reply will not be send. The timing can be adjusted in the script for msn plus.

For now it can also be used to reply once cuz i never go clear the contents in send.txt after every reply is detected. Will cont to improve on it with Runarius and alejoar next time.



MSN.rar
 Description:

Download
 Filename:  MSN.rar
 Filesize:  3.19 KB
 Downloaded:  702 Time(s)

Back to top
View user's profile Send private message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Sun Jul 22, 2007 8:50 pm    Post subject: Reply with quote

will take a look at everything a little bit later this evening, but I will most likely not do anything more scripting or anything for atleast two weeks. But a cool feature I would like to see is to be able to see all the online contacts, and then send messages to any of them. That would be really cool and not really that hard to do. msn-plus can extract the contact list, and the status of everyone. If somebody could just make that, then it wouldn't be much to do to have it finished.

btw, good work alejoar and phatez.

EDIT:

Phatez, I had a little look at your modification. Why are you using the timer, really? To answer within 5 seconds is a little short of time, I think that we should be able to answer an unlimited ammount of time after the message is recieved. And also, the timer gives an error in the script(check your debugger)
Back to top
View user's profile Send private message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Mon Jul 23, 2007 2:11 am    Post subject: Reply with quote

New and last release from me in atleast two weeks. This time, you are able to both recieve and send messages. messages don't need to be sent within a time-limit, you can wait for a whole day if you wanted. Messages are sent every five second, which can be changed ofcourse. Don't think there are any bugs in this one, except for that we are still using the handle-name for sending messages, which means that when bob sends you a message, you must not close bob's message window untill the message has been sent. I think we should send messages by using their e-mail-address instead, since then, we can send messages to them without having their chat-window open. I have done a little bugfixing ofcourse. In phatez release, messages that has been sent were not deleted from the queue, they now are, and you can queue multiple messages and they will be sent at the same time(ofcourse in the right order). earlier, if you wrote two messages within five seconds(inbetween everytime msn-plus checks the message queue for messages) it would send the first one and delete all. now it sends the first one and deletes it, goes on to the next and deletes it and it does this in a loop. So that should take care of all possible bugs.

But please, somebody figure out a way to send a person a message by only knowing their e-mail adress instead of the window-handle. And it would be nice to have a online-contact-list. A little question for you. Ofcourse if I use msn the normal way, alot of messages will be stored in the salling_log.txt so when I open msn on my phone in salling clicker alot of old messages will show up. I would like a little work-around for this. is it possible to check if I have written a message back to a person? if so, I would like a little addition to the msn-plus-script. When I write back to a person, the script would check to see if it has stored any messages from that person that I am writing to, and if it has, it deletes those messages from the salling_log file. Then messages that has already been answered will not show up on the phone.

Also, salling, please help me with my question earlier on.

Edit the two first lines in the MSN.js file in the MSN folder which should be stored in My Salling Scripts and put the Salling folder in the MSN-plus-scripts folder. hmm... just keep thinking it should be the other way around.

please give some feedback while I am away

enjoy:D

EDIT:

Also, I took a look at getting the online contacts into a textfile.... Works pretty good, only problem is when people use strange symbols in their names, which gives errors, surely there must be a way to avoid these special symbols?

here is the function:

[code:1]function getOnlineContacts()
{
var Contacts = Messenger.MyContacts;
var e = new Enumerator(Contacts);
//Empty the contacts file before re-buidling it.
onlineContacts = new Array();
try {

var settingsFileStream = fso.CreateTextFile( MsgPlus.ScriptFilesPath + '\\contacts.txt', true ); // overwrite

settingsFileStream.Close();
} catch( e ) {}
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
if(Contact.Status != 1)
{
onlineContacts[onlineContacts.length] = new Array(Contact.Name,Contact.Email,status[Contact.Status],Contact.PersonalMessage);
AddLineToFile("contacts.txt","<name>"+Contact.Name+"</name><email>"+Contact.Email+"</email><status>"+status[Contact.Status]+"</status><pMsg>"+Contact.PersonalMessage+"</pMsg>");
}
}

}[/code:1]



MSN for salling clicker.zip
 Description:
v.0.3 23rd of July

Download
 Filename:  MSN for salling clicker.zip
 Filesize:  3.96 KB
 Downloaded:  632 Time(s)

Back to top
View user's profile Send private message
alejoar
Senior Member


Joined: 19 Jun 2007
Posts: 62

PostPosted: Mon Jul 23, 2007 7:08 am    Post subject: Reply with quote

[b]EDIT: Damn, how stupid I am?? xD I didn't read the last part of your message Well, I already done the online contacts funtion so Ill leave it there... damn it!
[/b]

Runarius, that works absolutely great! The only issue I found is that when the message recived is too long it falls off the screen, I dont know if its possible, but an up-down scrolling would be marvelous.


Regarding the msn-plus script, I updated it so that it updates a new file ("online_contacts.txt") with the following format:

<email>"email"</email><nick>"nick"</nick>
.
.

Please modify the format acording to the salling clicker script needs.

This file will be created/updated when you login and then every minute from there on, but you can also change the update interval modifying the var [b]UpdateOnlineContactsInterval[/b] to whatever you want, allways in miliseconds (60000 = 1 minute).

Here it is
(add at the end of the current script):
[code:1]
///////online_contacts.txt section
var UpdateOnlineContactsInterval = "60000";

function CheckOnlineContacts() {
fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + "online_contacts.txt", 2, 1);
var contacts = Messenger.MyContacts;
for(var e = new Enumerator(contacts); !e.atEnd(); e.moveNext()){
item = e.item();
if(item.Status != 1 && item.Status != 0){
var OnlineContact = "<email>" + item.Email + "</email>" + "<nick>" + item.Name + "</nick>";
AddLineToFile ("online_contacts.txt", OnlineContact);
} else {
//print offlines?
}
}
MsgPlus.AddTimer("UpdateOnlineContacts", UpdateOnlineContactsInterval);
}

function OnEvent_Timer(UpdateOnlineContacts) {
CheckOnlineContacts();
}

function OnEvent_SigninReady(MessengerStart) {
CheckOnlineContacts();
}
[/code:1]


Your request for sending the message only with the email (not using the window handle) is my next priority.
Back to top
View user's profile Send private message
alejoar
Senior Member


Joined: 19 Jun 2007
Posts: 62

PostPosted: Mon Jul 23, 2007 8:04 am    Post subject: Reply with quote

Hello again, I made this simple function that sends a message without knowing the window handle..

Unfortunately, afaik, it is not possible to send a message without opening a chat window. So I think we have no alternative here xD.

[code:1]function SendMessage(email, msg) {
var ChatWnd = Messenger.OpenChat(email);
ChatWnd.SendMessage(msg);
}[/code:1]

[b]EDIT:[/b]
I think I have found a possible solution:

[code:1]function SendMessage(email, msg) {
var ChatWnd = Messenger.OpenChat(email);
ChatWnd.SendMessage(msg);
ChatWnd.SendMessage("/close");
}[/code:1]

When using msgplus, you can use "/close" to close the current chat window, so by adding this line all we will see is a quick splash.. well, its better than nothing :P

Anyways, I think we should make this optional, it doesn't really bothers me if the window pops up (I dont chat while watching a movie :P).
Back to top
View user's profile Send private message
phatez
Junior Member


Joined: 07 Jun 2007
Posts: 49

PostPosted: Mon Jul 23, 2007 12:29 pm    Post subject: Reply with quote

I made a few changes to msn.js

This is regarding Runarius your bug which salling havent ans to it.
So i decide why not we choose to view all the incoming msg first, and then decide who to reply to.

There will be 2 options at first, first one is check for msg, second one is see all ppl you are chatting with and reply them.
What i wanna achieve is when click check for msg, the wating widget will show up and wait or check for msg, but due to some bug which i cant solve,
i make it such that when u click check, it will only check and return to the main screen.

Runarius i need your help for that. Cuz that's ur script. Sorry i messed up abit though.

Known bugs(dunno is it only me or what) :
When you click on current chats, the name will be appended below:
[code:1]//////////////////////
Check for new message
current chats
//////////////////////

become ->

//////////////////////
Check for new message
current chats
Name
//////////////////////


and not this::::

//////////////////////
Name
//////////////////////
[/code:1]

But still must choose the first option to choose the first name, and not the name itself.



MSN.js
 Description:

Download
 Filename:  MSN.js
 Filesize:  5.41 KB
 Downloaded:  642 Time(s)



Last edited by phatez on Mon Jul 23, 2007 12:40 pm; edited 2 times in total
Back to top
View user's profile Send private message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Mon Jul 23, 2007 12:31 pm    Post subject: Reply with quote

ah... nice... now we are almost done with the whole script. now we just need a solution for special characters and we have no more problems I think:)

phatez, I really don't have time for any more of this now. I will checkout now for two weeks. Really can't think any more about this.
Back to top
View user's profile Send private message
alejoar
Senior Member


Joined: 19 Jun 2007
Posts: 62

PostPosted: Mon Jul 23, 2007 5:43 pm    Post subject: Reply with quote

phatez, current chats is working fine on my phone, good work!

Did someone came up with something to solve the scrolling thing I mention before? My phone screen size is very small :S
Back to top
View user's profile Send private message
Runarius
Senior Member


Joined: 19 Nov 2006
Posts: 124

PostPosted: Mon Jul 23, 2007 6:20 pm    Post subject: Reply with quote

well, instead of the CreateQuestion thingy, do a CreateMessageBox... that solves the problem. doesn't give us the choice to answer no, but we don't really have that now anyways,
Back to top
View user's profile Send private message
phatez
Junior Member


Joined: 07 Jun 2007
Posts: 49

PostPosted: Mon Jul 23, 2007 6:59 pm    Post subject: Reply with quote

Some bug fix. Now you do not need to even click NO. View message can be scroll too. Check message now continuously display the message rather than display one and then go back to the main screen.

But the appending of the widget thing, is it only my phone(ngage) or what? Can feedback me on this? thanks.

Anyway now i have this idea. If check message and it detect that the same person has send a few msg, they will all be shown in one dialog box instead of different one.



MSN.js
 Description:

Download
 Filename:  MSN.js
 Filesize:  5.49 KB
 Downloaded:  631 Time(s)

Back to top
View user's profile Send private message
alejoar
Senior Member


Joined: 19 Jun 2007
Posts: 62

PostPosted: Mon Jul 23, 2007 7:46 pm    Post subject: Reply with quote

awesome phatez!! this is getting better and better, all thats left is to display the contact list and display new messages automatically when recieved.

[quote]But the appending of the widget thing, is it only my phone(ngage) or what? Can feedback me on this? thanks. [/quote]

Do you mean the "current chats" menu?
How can I help you? It is working fine with my phone, its a motorola L6, but this is helpless. Maybe salling can give you a hand with this.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows All times are GMT + 2 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 2 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group