Is there a script to.....? - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Is there a script to.....? (/showthread.php?tid=66188)
Is there a script to.....? by lu_benja on 09-13-2006 at 06:39 PM
getting disconected from the messenger in a time that I choose ?
RE: Is there a script to.....? by Jesus on 09-13-2006 at 06:40 PM
I'll make it for you now, will be easy
RE: Is there a script to.....? by lu_benja on 09-13-2006 at 06:43 PM
wowww thank you!!
RE: Is there a script to.....? by Jimbo on 09-13-2006 at 06:51 PM
code: var allowed;
var restricted = ''; //Edit to your Email
function OnEvent_Signin(){
if (Messenger.MyEmail == restricted && allowed == false){
Messenger.Signout();
}
if (Messenger.MyEmail == restricted){
MsgPlus.AddTimer("AcTime", 60*60*1000);//Ads a 1 hour timer for access time
}
}
That should work but i haven't tested it
quote: originally posted by jesus
I'll make it for you now, will be easy
Sorry, do you want me to delete mine?
RE: Is there a script to.....? by vaccination on 09-13-2006 at 06:54 PM
quote: Originally posted by 134jimbodude
code:
var allowed;
var restricted = ''; //Edit to your Email
function OnEvent_Signin(){
if (Messenger.MyEmail == restricted && allowed == false){
Messenger.Signout();
}
if (Messenger.MyEmail == restricted){
MsgPlus.AddTimer("AcTime", 60*60*1000);//Ads a 1 hour timer for access time
}
}
That should work but i haven't tested it
That isn't going to allow him/her to choose when to sign out though is it? (i don't have any scripting knowledge TBH but it doesn't look like it will )
RE: Is there a script to.....? by lu_benja on 09-13-2006 at 06:56 PM
thanks but I don't know how to make it work
I put the script but it's not showing it
RE: Is there a script to.....? by Ezra on 09-13-2006 at 06:57 PM
quote: Originally posted by vaccination
That isn't going to allow him/her to choose when to sign out though is it? (i don't have any scripting knowledge TBH but it doesn't look like it will
nope indeed, because he forgot the timer Event and also I don't think the means the wants to stay online for 1 or 2 hours, but the wants msn to offline on 7pm for example right?
RE: Is there a script to.....? by Jesus on 09-13-2006 at 07:02 PM
code: function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
Debug.Trace(Message.split(' ')[0])
if(Message.split(" ")[0] == "/dsignout")
{
MsgPlus.AddTimer("signout", Message.split(" ")[1] * 60000)
return ""
}
}
function OnEvent_Timer(signout)
{
Messenger.Signout()
}
function OnGetScriptCommands()
{
var commands = "<ScriptCommands>"
commands += " <Command>"
commands += " <Name>dsignout</Name>"
commands += " <Description>Signs you out after a specified amount of time</Description>"
commands += " <Parameters><time in seconds></Parameters>"
commands += " </Command>"
commands += "</ScriptCommands>"
return commands
}
use /dsignout 5 to sign out after 5 seconds minutes.
minutes will be a bit more useful for this purpose
RE: RE: Is there a script to.....? by vaccination on 09-13-2006 at 07:03 PM
quote: Originally posted by Ezra
quote: Originally posted by vaccination
That isn't going to allow him/her to choose when to sign out though is it? (i don't have any scripting knowledge TBH but it doesn't look like it will
nope indeed, because he forgot the timer Event and also I don't think the means the wants to stay online for 1 or 2 hours, but the wants msn to offline on 7pm for example right?
Hah i thought it wouldn't, go me
And yes i believe he/she wants wlm to sign out after say 7pm.
RE: Is there a script to.....? by Jesus on 09-13-2006 at 07:05 PM
lol thought he meant after a specified amount of time
maybe I'll do that later if no one else volunteers
RE: Is there a script to.....? by lu_benja on 09-13-2006 at 07:11 PM
I meant to choose the time and date
RE: Is there a script to.....? by vaccination on 09-13-2006 at 07:12 PM
quote: Originally posted by Jesus
lol thought he meant after a specified amount of time
maybe I'll do that later if no one else volunteers
Yeah maybe, TBH we need him to come back and clear this up
RE: Is there a script to.....? by lu_benja on 09-14-2006 at 01:46 PM
someone can do the script?
RE: Is there a script to.....? by crank on 09-15-2006 at 09:29 AM
Should be easy enough, i just do not feel like starting on it.
RE: RE: Is there a script to.....? by CookieRevised on 09-15-2006 at 11:18 AM
quote: Originally posted by 134jimbodude
That should work but i haven't tested it
Try not to post scripts/snippets if you didn't tested them....
Posting not working scripts can confuse people even more and people willing to learn scripting will learn the wrong things, etc.
(you actually pointed that out to me once ))
quote: Originally posted by Jesus
lol thought he meant after a specified amount of time
Before making scripts for people, always make sure you make what is been asked for, or first ask for more details.
eg: "# key and = key".
-------------------------------------------------------
PS: Jesus (or anyone): you also might wanna read this post regarding timers:quote: Originally posted by CookieRevised in "[release] Who's online"
Extremely important note:
Each and every script that uses timers to manipulate or check user related stuff should check if the same user is still signed in when the timer triggers!!!
It should check if it is still the same current user who is signed in and thus only perform the action if the user is the same as the one which started the timer.
Failing todo this will cause many unwanted errors and script behaviours when:
- the user signs out when a timer is still active
- a new user signs in before the timer is triggered and the action when the timer triggers is something like blocking a contact, changing status, retrieving contacts, etc...
All this because timers do not reset and aren't deleted when somebody signs out or when somebody else signs in.
Extremely many scripts make these faults...
Another, and sometimes better/more elegant, solution for the above problem (that is: if possible for the particular script) is to explicitly delete the timer when the user signs out.
Although 134jimbodude's code wouldn't work, he did take this in account as he checked the email address of the signed in user.
-------------------------------------------------------
Also another thing (or actually the same thing as above if you think about it) which makes this script not so strait forward as you might think is that scripts keep running and will not be restarted when other users sign in.
This makes that you should take in account that different users can set different sign out times. In other words, this script should save and load its setting (the set time) in a user specific way (ps: don't use the user's email address for this but rather the user's userid because of security reasons).
RE: Is there a script to.....? by Felu on 09-15-2006 at 12:05 PM
code: var now;
var signouttime;
function GetDate(){
var D = new Date();
var Hours = Addzero(D.getHours());
var Seconds = Addzero(D.getSeconds());
var Minutes = Addzero(D.getMinutes());
var Seconds = Addzero(D.getSeconds());
var Day = Addzero(D.getDate());
var Month = Addzero(D.getMonth() + 1);
var Year = Addzero(D.getYear());
now = Month+'/'+Day+'/'+Year+' - '+Hours+'/'+Minutes+'/'+Seconds;
//Debug.Trace(now);
}
function Addzero(va)
{
if (va<10)
{va="0" + va}
return va
}
function OnEvent_Timer(TimerId)
{
switch (TimerId){
case "Signout":
if (Messenger.MyStatus != 0) {
GetDate();
if(now == signouttime){
Messenger.Signout();
}
}
MsgPlus.AddTimer("Signout", 1000);
break;
}
}
MsgPlus.AddTimer("Signout", 1000);
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(Message.substr(0,12) == "/signouttime"){
signouttime = Message.substr(13)
Debug.Trace(signouttime);
return "";
}
}
function OnGetScriptCommands()
{
var commands = "<ScriptCommands>"
commands += " <Command>"
commands += " <Name>signouttime</Name>"
commands += " <Description>Signs you out on the specified time and date.</Description>"
commands += " <Parameters>MM/DD/YYYY - HH/MM/SS;</Parameters>"
commands += " </Command>"
commands += "</ScriptCommands>"
return commands
}
Just made that. Use /signouttime MM/DD/YYYY - HH/MM/SS with full values to define the date and time to sign out on .
RE: Is there a script to.....? by Matti on 09-15-2006 at 12:38 PM
quote: Originally posted by -!Felu!-
code: function Addzero(va)
{
if (va<10)
{va="0" + va}
return i
}
Err... what the heck is the i-variable supposed to be?
RE: Is there a script to.....? by Felu on 09-15-2006 at 12:39 PM
quote: Originally posted by Mattike
quote: Originally posted by -!Felu!-
code: function Addzero(va)
{
if (va<10)
{va="0" + va}
return i
}
Err... what the heck is the i-variable supposed to be?
the i viewed on the forums so i changed it forgot it there .
Fixed
RE: Is there a script to.....? by Matti on 09-15-2006 at 12:44 PM
quote: Originally posted by -!Felu!-
the i viewed on the forums so i changed it forgot it there .
Fixed
Heh, okay then.
RE: Is there a script to.....? by lu_benja on 09-15-2006 at 08:02 PM
I don't understand what you were talking about.. anyway..did someone do the script?
RE: RE: Is there a script to.....? by Jimbo on 09-15-2006 at 08:07 PM
quote: Originally posted by -!Felu!-
code: var now;
var signouttime;
function GetDate(){
var D = new Date();
var Hours = Addzero(D.getHours());
var Seconds = Addzero(D.getSeconds());
var Minutes = Addzero(D.getMinutes());
var Seconds = Addzero(D.getSeconds());
var Day = Addzero(D.getDate());
var Month = Addzero(D.getMonth() + 1);
var Year = Addzero(D.getYear());
now = Month+'/'+Day+'/'+Year+' - '+Hours+'/'+Minutes+'/'+Seconds;
//Debug.Trace(now);
}
function Addzero(va)
{
if (va<10)
{va="0" + va}
return va
}
function OnEvent_Timer(TimerId)
{
switch (TimerId){
case "Signout":
if (Messenger.MyStatus != 0) {
GetDate();
if(now == signouttime){
Messenger.Signout();
}
}
MsgPlus.AddTimer("Signout", 1000);
break;
}
}
MsgPlus.AddTimer("Signout", 1000);
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(Message.substr(0,12) == "/signouttime"){
signouttime = Message.substr(13)
Debug.Trace(signouttime);
return "";
}
}
function OnGetScriptCommands()
{
var commands = "<ScriptCommands>"
commands += " <Command>"
commands += " <Name>signouttime</Name>"
commands += " <Description>Signs you out on the specified time and date.</Description>"
commands += " <Parameters>MM/DD/YYYY - HH/MM/SS;</Parameters>"
commands += " </Command>"
commands += "</ScriptCommands>"
return commands
}
!felu! made that. Use /signouttime MM/DD/YYYY - HH/MM/SS with full values to define the date and time to sign out on .
RE: Is there a script to.....? by CookieRevised on 09-15-2006 at 08:32 PM
that script is serious faulty...
1) timers will still be triggered even if a different user has signed in
see "CookieRevised's reply to Is there a script to.....?"
2) time calculation is seriously faulty
a) signing out will not be done when the time has passed the set time
b) the output of now very highly depends on your system local time. This can be way different than mm/dd/yyyy - hh/mm/ss.
c) the output of getYear is a 2 digit number for years between 1900 and 1999, all other years produce a 4 digit number.
etc...
3) not taking in account user errors on the command line (I consider this minor though and not really a fault, more lazyness )
EDIT.
quote: Originally posted by 134jimbodude
oh yes, sorry, should i delete that post?
unless all the above is fixed, so should Felu in my humble, but harsh (i know), opinion...
RE: Is there a script to.....? by Jimbo on 09-15-2006 at 08:34 PM
oh yes, sorry, should i delete that post?
|