Shoutbox

[Betaish-Release] Recall Prefix - 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: [Betaish-Release] Recall Prefix (/showthread.php?tid=69940)

[Betaish-Release] Recall Prefix by Eljay on 12-26-2006 at 09:09 PM

Well some of you might remember a little registry setting in ye olde Messenger Plus! 3 that allowed you to add a prefix and suffix to messages sent using Text Recall (y'know, that Ctrl+Up/Down thingy).

It looked like this (well this is my script but that just shows how good its replicated eh :P)

[Image: RecallPrefix_Screenshot.png]

Well this script adds that little feature back, so without further ado here it is.

[Download]


RE: [Betaish-Release] Recall Prefix by deAd on 12-26-2006 at 09:53 PM

Why not use one string (instead of Prefix and Suffix) which contains a tag which would be replaced by the message?

Like

code:
[i][b][c=14]Recall: "[/c][/b]%message%[b][c=14]"[/c][/b][/i]

RE: [Betaish-Release] Recall Prefix by CookieRevised on 12-27-2006 at 03:14 AM

Nice idea and thingie :P (y)...


some things though:

* function ShowConfigWindow(){
check if config window isn't already showing
(too bad it doesn't make me that tea I wanted at the moment)

* function OnGetScriptMenu(){
Config opens a new window, so add "..."

* function OnEvent_MenuClicked(MenuItemId){
- no need for checking on the menuid when you use only 1 item
- you're missing a closing } in that function

* function SaveSettings(){
put everything in a error handling routine because Messenger.MyEmail will not always be defined (eg: user is logged out while config window is still showing).

* var OnEvent_Initialize = Startup;
Initialize (and thus Startup()) can/will be called before Messenger.MyEmail is defined. Thus use if(Messenger.MyStatus > 1).

* function Startup(){
It is possible that that registry key doesn't exist, so again error checking (default DWORD value is 1). But better yet:

* Check on EnablePreviousRecall each time, since this can be changed while user is logged in. To avoid reading regisrty each time a key is pressed, maybe read it only when a chat window is created. Do if(RecallEnabled == 1) instead of using '===' because, maybe, there is a change someone screwed up and saved the key as a string.

* When user uses other keys than alfanumerical, etc (eg: copy/paste and stuff), the script isn't in 'Waiting' state anymore and thus quote isn't send as a quote. But that's hard to fix properly and 100% and it is something minor anyways.

* When user uses mouse to paste some text after a quote has been send for exalmple, the new text will also be send as a quote. Add Waiting=false in OnEvent_ChatWndSendMessage().

* When another user signs in to Messenger, the default prefix/suffix values are not loaded. aka: don't define default values in global scope of the script but in the LoadSettings function.

* Make Waiting variable chat-specific so that when you select a quote and temporarly chat in another window, you can still send the quote as a quote in the first one.



* love the comments :p



PS: for those who want to know, in Messenger Plus! 3 the registry key to add/change a prefix or suffix:  HKCU\Software\Patchou\MsgPlus2\your@email.com\Preferences\QuoteFormat
see Help: Registry Tweaks


RE: [Betaish-Release] Recall Prefix by NanaFreak on 12-27-2006 at 05:13 AM

umm how exactly do i use it :S

dont worry i got it :P

nice work (Y)


RE: [Betaish-Release] Recall Prefix by CookieRevised on 12-27-2006 at 05:19 AM

quote:
Originally posted by NanaFreak
umm how exactly do i use it :S
It adds a prexif and/or suffix to the quoted messages when you send them. So, simply select a quoted message and send it...

To select a quoted message in Messenger Plus! Live, press CTRL+UP or CTRL+DOWN in a conversation window (this is a standard feature of Plus!, the only thing the script does is altering the message a bit when it is send).
RE: [Betaish-Release] Recall Prefix by Matti on 12-27-2006 at 09:40 AM

I must say this script is great, but I have one problem with this script. As script developer, I have to test my script commands time and time again to make sure it works well, so I use CTRL+UP a lot to repeat a command. However, because the script adds a prefix in front of it, it doesn't get parsed. Therefore, I had to modify your script. :P

So, what you should do in your OnEvent_ChatWndSendMessage is:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
  if(Waiting) {
    //If there are 2 slashes preceding the message (so it's an escaped command)...
    if(Message.substr(0,2) == "//") {
       //If the prefix contains some useful characters, return with one slash
       if(Prefix.length > 0) return Prefix + Message.substr(1) + Suffix;
       //Else, return with 2 slashes so it gets escaped by Plus!
       else return Message + Suffix;
    //Or, if the message is preceded by one slash (so it's a command), return it
    } else if(Message.charAt(0) == "/") return Message;
    //If there is no slash in front, add the prefix and suffix anyway
    else return Prefix + Message + Suffix;
  }
}
Tested and using! ;)
RE: [Betaish-Release] Recall Prefix by Eljay on 12-27-2006 at 11:53 AM

I can't be bothered saying exactly what I've changed, I just went through Cookie's comments and changed things accordingly (and yours Mattike ;)).
Please take another look Cookie :P

Download link same as before (here if you're too lazy to scroll up)


RE: [Betaish-Release] Recall Prefix by linx05 on 12-27-2006 at 01:06 PM

So simple yet so handy. This is definitely a keeper!