Shoutbox

Is it possible... - 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 it possible... (/showthread.php?tid=76845)

Is it possible... by Zageron on 08-18-2007 at 03:07 AM

To grab an auto updated text (or variable) Such as a "This user is currently" element, and make it your personal message?

Simplified.\/

Zageron
Member
Browsing Profiles
Overall Rank:    1,891
Average Rank:    10,836
Games Played:    5,753
Multiplayer Level:    11
Last Activity:    08-17-2007
Forum Posts:    370

Simplified. /\

I would love to be able to take that "Browsing Profiles" and make it show up as my personal MSN message. Is is possible to script this?


RE: Is it possible... by ShawnZ on 08-18-2007 at 03:08 AM

no, as jscript doesn't have accessors. you would have to use a timer to check when the variable updates.


RE: Is it possible... by Zageron on 08-18-2007 at 03:10 AM

But, what exactly is the difference between "Current Media" and "Current Status"?

I have the exact variable address for MY status. Getting someone else's would be as simple as making the script JUST for them...


RE: Is it possible... by ShawnZ on 08-18-2007 at 03:12 AM

current media is what song you're playing in windows media player, current status is the status you're currently using

8434513 GET


RE: Is it possible... by Zageron on 08-18-2007 at 03:13 AM

Sorry that wasn't what I meant.

I mean.

What is the difference between "Grabbing the song that you are currently playing in Media player" and grabbing the current status that is being shown on a website.


RE: Is it possible... by ShawnZ on 08-18-2007 at 03:15 AM

quote:
Originally posted by Zageron
What is the difference between "Grabbing the song that you are currently playing in Media player" and grabbing the current status that is being shown on a website.

err, they're two different things?

....456455 get
RE: Is it possible... by Zageron on 08-18-2007 at 03:26 AM

Sorry. I'm thinking your posting for spite. If you don't know what I'm talking about then please don't answer. I'm talking about a simple 'grabbing of MySQL output variable' and updating it everytime it changes.


RE: Is it possible... by MeEtc on 08-18-2007 at 03:38 AM

yes, this is possible. I'm doing the exact same thing for the script that I'm working on right now. The easiest way to do this is create a php script for yourself that echos the contents that you want to show. Then you can use an XMLHTTP object to read the contents of the output. here's a snippet:

code:
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://www.domain.com/file.php", true);
xmlhttp.onreadystatechange = function(){
   if(xmlhttp.readyState == 4) {
      if(xmlhttp.status == 200) {
         Debug.Trace('Data returned: ' + xmlhttp.responseText)
      } else {
         Debug.Trace('Error: Could not open web page');
      }
   }
}


RE: Is it possible... by Zageron on 08-18-2007 at 03:47 AM

Thanks.

I'm not quite sure how to load that EXACT piece of text though. Just enter the variable address? o.O?


Edit:

Actually I'm not quite sure how to even start this... :(

If it's easy enough I just want my Personal message to show the single ever changing piece of text shown on this page.
http://www.flashflashrevolution.com/profile/Zageron/
Variables
"Browsing FFR Profiles"
"Playing FFR"
"Browsing FFR Forums"
"Offline" (This would show if, in fact, there was no variable active.) (Or the site detected me nowhere.)


RE: Is it possible... by roflmao456 on 08-18-2007 at 04:00 AM

Hello! try this code (works! tested. but not sure if any bugs are in):

code:
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://www.flashflashrevolution.com/profile/Zageron/", true);
xmlhttp.onreadystatechange = function(){
   if(xmlhttp.readyState == 4) {
      if(xmlhttp.status == 200) {
         var status = '';
         if(xmlhttp.responseText.search("Browsing FFR Profiles") != -1){
                  status = "Browsing FFR Profiles";
         } else {
         if(xmlhttp.responseText.search("Playing FFR") != -1){
                  status = "Playing FFR";
         } else {
         if(xmlhttp.responseText.search("Browsing FFR Forums") != -1){
                  status = "Browsing FFR Forums";
         } else {
                  status = "Offline";
         }}}
         Messenger.MyPersonalMessage = "Zageron: " + status;
      } else {
         Messenger.MyPersonalMessage = "Zageron: Offline";
      }
   }
}
xmlhttp.send(Math.random()*99999);


oops, forgot to send the request :p

RE: Is it possible... by Zageron on 08-18-2007 at 04:04 AM

Nothing is showing up in my personal message.

Is there something special I have to do?

THANKS! BTW.


RE: Is it possible... by roflmao456 on 08-18-2007 at 04:05 AM

quote:
Originally posted by Zageron
Nothing is showing up in my personal message.

Is there something special I have to do?

THANKS! BTW.
updated, i forgot the send request code xmlhttp.send(Math.random()*99999);


edit: it works!

gotta sleep for the night, bye :p
RE: Is it possible... by Zageron on 08-18-2007 at 04:13 AM

Thank you very much!

So far, it seems, the script only updates when I...
Log in to MSN
or
Click 'Save All' in the "edit script area".

What is a function that I can use to update it every  seconds?


RE: Is it possible... by Matti on 08-18-2007 at 10:04 AM

quote:
Originally posted by Zageron
What is a function that I can use to update it every  seconds?
You should add a timer which does the check every X milliseconds. The following is a template about how you should do this the right way.
code:
var nTimerOffset = 60 * 1000; //Set the timer offset to one minute (1 min = 60 s = 60000 ms)

//The OnEvent_Initialize event calls OnEvent_SigninReady if you're already signed in on script start.
function OnEvent_Initialize(bMessengerStart) {
   if(Messenger.MyStatus > 0) OnEvent_SigninReady(Messenger.MyEmail);
}

//The OnEvent_SigninReady event calls your update function and then creates a timer when you sign in to Messenger.
function OnEvent_SigninReady(sEmail) {
   UpdateIt(); //UpdateIt is your update function
   MsgPlus.CreateTimer("TimerUpdate", nTimerOffset); //Creates a timer
}

//The OnEvent_Signout event cancels the timer.
function OnEvent_Signout(sEmail) {
   MsgPlus.CancelTimer("TimerUpdate");
}

//The OnEvent_Timer event calls your update function and re-creates the timer so it'll create a timed loop.
function OnEvent_Timer(sTimerId) {
   if(sTimerId == "TimerUpdate") {
      UpdateIt(); //Your update function
      MsgPlus.AddTimer(sTimerId, nTimerOffset); //Re-creates the timer
   }
}

function UpdateIt() {
   //Code goes here...
}