[HELP] Send On Signin |
Author: |
Message: |
fnatiq
New Member
Posts: 5
32 / /
Joined: Jan 2009
|
O.P. [HELP] Send On Signin
Hello,
I Downloaded the file from http://shoutbox.menthix.net/showthread.php?tid=63043
But now i want to automaticly send a text when someone comes online.
I tried to change it and set it up like this
function OnEvent_ContactSignin(Email){
if(!fso.FolderExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"))
fso.CreateFolder(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\");
if(Messenger.MyContacts.GetContact(Email).status!=1){
var Contact = Messenger.MyContacts.GetContact(Email);
if(fso.FileExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"+Email+".txt")){
}
Open(Contact);
}
}
function Open(Contact){
CWnd = Messenger.OpenChat(Contact.Email);
CWnd.SendMessage(fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"+((Contact.Network===1)?"":"yahoo:")+Contact.Email+".txt",1).ReadAll().replace(/[\s\S]{2}$/,""));
setTimeout ( 'Open(Contact)', 3000 );
That works, but it sends the message too fast.
I tried the timer but that don't work.
Can somebody help me.
PS. The orginal topic is closed that's why i started a new topic
|
|
01-12-2009 12:38 PM |
|
|
mynetx
Skinning Contest Winner
Microsoft insider
Posts: 1175 Reputation: 33
37 / /
Joined: Jul 2007
|
|
01-12-2009 12:42 PM |
|
|
fnatiq
New Member
Posts: 5
32 / /
Joined: Jan 2009
|
O.P. RE: [HELP] Send On Signin
Yea i did but i dont know what to do now
Just a beginner
|
|
01-12-2009 12:46 PM |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
Joined: Jan 2006
|
RE: [HELP] Send On Signin
It has been quite a long time since I have worked on this script so please realise that I might not get this right, but I think all you need to do is modify lines 24 and 32 in the original script to the following code (replacing what is already there).
code: Open(Contact);
If you still want the toasts to be made you can keep the old code there (but I do suggest modifying it so that it say something more practical and related to what it has done).
I hope this helps.
|
|
01-12-2009 01:18 PM |
|
|
fnatiq
New Member
Posts: 5
32 / /
Joined: Jan 2009
|
O.P. RE: [HELP] Send On Signin
It's give the same effect.
When i do that, the script send the text faster than the person comes online. So the person can't see the "Welcomes text"
|
|
01-12-2009 01:24 PM |
|
|
markee
Veteran Member
Posts: 1622 Reputation: 50
36 / /
Joined: Jan 2006
|
RE: [HELP] Send On Signin
Sorry, I didn't see you needed the timer. Please try the following code (i just copied it all as it as easier).
code: var waitTime = 100; // Please change this variable to be the number of milliseconds you wish to wait before the message is sent
///////////////////////////////////////////////////////
//
// This script is written by Mark 'markee' Kernke
//
// Please do not reproduce this script (part or whole)
// without prior concent of the author.
//
///////////////////////////////////////////////////////
var Status = new Array("","Offline","","Online","Busy","Be Right Back","Idle","Away","In a Call","Out to Lunch");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var E2;
function OnEvent_Initialize(M){
if(!fso.FolderExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"))
fso.CreateFolder(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\");
}
function OnEvent_ContactSignin(Email){
if(!fso.FolderExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"))
fso.CreateFolder(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\");
if(Messenger.MyContacts.GetContact(Email).status!=1){
var Contact = Messenger.MyContacts.GetContact(Email);
if(fso.FileExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"+Email+".txt")){
MsgPlus.DisplayToastContact("Send On Sign-in",Contact.Name,"Signed in ("+Status[Contact.Status]+")\r\nClick to send personal hello","","Open",Contact);
MsgPlus.AddTimer(Email,waitTime); //extra code
}else{
MsgPlus.DisplayToastContact("Send On Sign-in",Contact.Name,"Signed in ("+Status[Contact.Status]+")\r\nClick to Open Chat","","Chat",Contact);
}
}else if(Messenger.MyContacts.GetContact("yahoo:"+Email).status!=1){
Email = "yahoo:"+Email;
var Contact = Messenger.MyContacts.GetContact(Email);
if(fso.FileExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"+Email+".txt")){
MsgPlus.DisplayToastContact("Send On Sign-in",Contact.Name,"Signed in ("+Status[Contact.Status]+")\r\nClick to send personal hello","","Open",Contact);
MsgPlus.AddTimer(Email,waitTime); //extra code
}else{
MsgPlus.DisplayToastContact("Send On Sign-in",Contact.Name,"Signed in ("+Status[Contact.Status]+")\r\nClick to Open Chat","","Chat",Contact);
}
}
}
function Chat(Contact){
Messenger.OpenChat(Contact.Email);
}
function Open(Contact){
CWnd = Messenger.OpenChat(Contact.Email);
CWnd.SendMessage(fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"\\"+((Contact.Network===1)?"":"yahoo:")+Contact.Email+".txt",1).ReadAll().replace(/[\s\S]{2}$/,""));
}
function OnGetScriptMenu(Location){
var ScriptMenu ="<ScriptMenu>";
ScriptMenu +="<MenuEntry Id=\"Pref\">Preferences</MenuEntry>";
ScriptMenu +="</ScriptMenu>";
return ScriptMenu;
}
function OnEvent_MenuClicked(MenuId,Location,ChatWnd){
if(MenuId=="Pref"){
StartPref();
}
}
function StartPref(){
var Wnd = MsgPlus.CreateWnd("UI.xml","WndUI",1);
var i=0;
var arr = new Array();
var Email;
var e = new Enumerator(Messenger.MyContacts);
for(;!e.atEnd();e.moveNext()){
arr[i] = ((e.item().Network===1)?e.item().Email:"yahoo:"+e.item().Email);
i++;
}
arr = arr.sort();
if(!fso.FolderExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\")){
fso.CopyFolder(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId, MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy");
}
for(i in arr){
Wnd.LstView_AddItem("ListContacts",arr[i]);
Wnd.LstView_SetItemText("ListContacts",i,1,Messenger.MyContacts.GetContact(arr[i]).Name);
}
Wnd.visible = true;
}
function OnWndUIEvent_CtrlClicked(Wnd,Ctrl){
switch(Ctrl){
case "BtnSave":
ts = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\"+E2+".txt",2,true)
ts.WriteLine(Wnd.GetControlText("EdtSend"));
ts.Close();
fso.CopyFolder(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy",MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId);
Wnd.Close(0);
E2 = "undefined";
break;
case "BtnApply":
ts = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\"+E2+".txt",2,true)
ts.WriteLine(Wnd.GetControlText("EdtSend"));
ts.Close();
fso.CopyFolder(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy",MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId);
E2 = "undefined";
break;
}
}
function OnWndUIEvent_LstViewClicked(Wnd,Ctrl,Index){
ts = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\"+E2+".txt",2)
ts.WriteLine(Wnd.GetControlText("EdtSend"));
ts.Close();
E2 = Wnd.LstView_GetItemText(Ctrl,Index,0);
Debug.Trace(E2);
if(!fso.FileExists(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\"+E2+".txt")){
ts = fso.CreateTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\"+E2+".txt");
ts.WriteBlankLines(1);
ts.Close();
}
Wnd.SetControlText("EdtSend","");
ts = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\"+Messenger.MyUserId+"copy\\"+E2+".txt",1,true)
Wnd.SetControlText("EdtSend",ts.ReadAll().replace(/[\s\S]{2}$/,""));
ts.Close();
}
function OnEvent_Timer(TimerId){
Open(Messenger.MyContacts.GetContact(Email));
}
This post was edited on 01-12-2009 at 01:36 PM by markee.
|
|
01-12-2009 01:35 PM |
|
|
fnatiq
New Member
Posts: 5
32 / /
Joined: Jan 2009
|
O.P. RE: [HELP] Send On Signin
Scriptdebugger gifs a error at this line
function OnEvent_Timer(TimerId){
Open(Messenger.MyContacts.GetContact(Email));
}
|
|
01-12-2009 01:44 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [HELP] Send On Signin
quote: Originally posted by fnatiq
Scriptdebugger gifs a error at this line
function OnEvent_Timer(TimerId){
Open(Messenger.MyContacts.GetContact(Email));
}
Should be:
js code: function OnEvent_Timer(TimerId){
Open(Messenger.MyContacts.GetContact(TimerId));
}
|
|
01-12-2009 01:58 PM |
|
|
fnatiq
New Member
Posts: 5
32 / /
Joined: Jan 2009
|
O.P. RE: [HELP] Send On Signin
Yes it works thanks a lot for your time mate
|
|
01-12-2009 02:05 PM |
|
|
|
|