Shoutbox

Messenger Plus: How To Read a Text File? - 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: Messenger Plus: How To Read a Text File? (/showthread.php?tid=91156)

Messenger Plus: How To Read a Text File? by MrAsterisco on 06-22-2009 at 05:45 PM

Hi everyone! I'm new in developing for Messenger Plus, but I'm not new in developing applications. I need your help for a script: I use Parallels Desktop to virtualize Windows on my Intel Mac; I used to use Adium, but I need some key features included only in Windows Live Messenger for Windows. At the same time, I'd like to show the song I'm listening to in iTunes (on Mac OS X) in my personal message (in Windows Live Messenger on Windows).
My first idea is to build an application for Mac that reads the song playing in iTunes and write it to a text file; then the Messenger Plus script has to read that text file and set the personal message.

I searched everywhere, but I didn't find a way to read a text file in Messenger Plus: is it possible? If yes, how?

Thanks in advance!


RE: Messenger Plus: How To Read a Text File? by matty on 06-23-2009 at 03:31 AM

surfichris's reply to Tips


RE: Messenger Plus: How To Read a Text File? by robert_dll on 06-24-2009 at 10:08 PM

And how can I read something specific? For example, if I want to read the text next to "hi" in a file which content is "hi robert".


RE: Messenger Plus: How To Read a Text File? by Matti on 06-25-2009 at 09:45 AM

quote:
Originally posted by robert_dll
And how can I read something specific? For example, if I want to read the text next to "hi" in a file which content is "hi robert".
That totally depends on what is static in "hi robert".
  • If you want to read the first word of a file, you can use a regular expression on the file's content:
    Javascript code:
    var sContent = "hi robert";
    var sResult = sContent.match(/^\b(\w+)\b/)[1];
    // Result now equals "hi" as this is the first word

  • If you know that "robert" is always the second word in the file and need to know what's in front of it:
    Javascript code:
    var sContent = "hi robert";
    var sResult = sContent.match(/^(.+)\srobert/)[1];
    // Result now equals "hi" as this comes before "robert"

  • ...

RE: Messenger Plus: How To Read a Text File? by robert_dll on 06-25-2009 at 02:42 PM

What I want is to read the word next to "hi", but I think I can do it from here, thanks Matti