Guest

Untitled

By: a guest on Mar 19th, 2010  |  syntax: None  |  size: 8.28 KB  |  hits: 259  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. //Script Written By TheGuRuSupremacy :D:D:D:D
  2. var PatchOld = "\x0F\x85\x9E\x00\x00\x00"
  3. var PatchNew = "\xE9\x9F\x00\x00\x00\x90"
  4. var PatchAddress9
  5. var Active = new Boolean();
  6. var ShowToast = new Boolean();
  7. var PatchOldUnlimitedNudge="\x8B\x86\x60\x03\x00\x00"
  8. var PatchNewUnlimitedNudge="\x33\xC0\x40\x90\x90\x90";
  9. var PatchIconOld ="\x53"
  10. var PatchIconNew= "\x50"
  11. var AddressIcon
  12. var Address
  13. var delay= new Array()
  14. var NudgesNumber= new Array()
  15. var Installed = new Boolean()
  16. var WNDAbout
  17. var i
  18.  
  19. function OnAboutWNDEvent_CtrlClicked(PlusWnd, ControlId){
  20. WNDAbout=PlusWnd
  21. if (ControlId=="Button2"){
  22. PlusWnd.Close(1)}else if(ControlId=="LinkID"){new ActiveXObject("WScript.Shell").run("http://www.msgpluslive.net/scripts/view/277-NudgesToolsScript/")}
  23. else if(ControlId=="Button3"){new ActiveXObject("WScript.Shell").run("http://www.msghelp.net/showthread.php?tid=72775&page=1")}
  24. }
  25.  
  26. function OnNDSOptionsEvent_CtrlClicked(PlusWnd, ControlId){
  27. if (ControlId=="BtnOk"){
  28. var oShell = new ActiveXObject("WScript.Shell")
  29. if (PlusWnd.Button_IsChecked("ShowToast")==true){
  30. oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast", true & 1, "REG_DWORD");}else if
  31. (PlusWnd.Button_IsChecked("ShowToast")==false){
  32. oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast", false & 1, "REG_DWORD");}
  33. PlusWnd.Close(1)}}
  34.  
  35. function GetTempPath() {
  36.         var sBuffer = Interop.Allocate((260+1)*2);
  37.         Interop.Call('kernel32', 'GetTempPathW', 100, sBuffer);
  38.         return sBuffer.ReadString(0);
  39. }
  40.  
  41. function DownloadFile(FileName){
  42. try {
  43. var Path=GetTempPath() + "\\NDS.plsc"
  44. Debug.Trace(Path)
  45. MsgPlus.DownloadFile(FileName,Path)}
  46. catch(exception) {
  47. MsgPlus.DisplayToast("NudgesToolsSCRIPT",exception)
  48. }}
  49.  
  50. function OnEvent_DownloadFileComplete(Url,OutFile,Success){
  51. if (Url=="http://thegurusupremacy.googlepages.com/NudgesToolsScript-1.25.plsc"){
  52. if (Success==true){
  53. try{Debug.Trace("Installing...")
  54. Interop.Call('shell32', 'ShellExecuteW', 0, 'open', OutFile, '', '', 1)}
  55. catch(exception) {
  56. MsgPlus.DisplayToast("NudgesToolsSCRIPT",exception)}}}}
  57.  
  58. function OnEvent_Initialize(bMessengerStart) {
  59. if (Messenger.MyStatus > 0) OnEvent_Signin();}
  60.  
  61. function OnEvent_Signin(sEmail) {
  62. PatchAddress9=[0x562E3E,0x564266,0x564A4F]
  63. AddressIcon= [0x561F42,0x56336A,0x563B53]
  64. Address=[0x562EE2,0x56430A,0x564AF3]
  65. if (Messenger.Version<=8.5){
  66. MsgPlus.DisplayToast("NudgesTools", "NudgesToolsScript 1.36 is not compatible with WLM8,click here to download and install a compatible version.Thank You!","","DownloadFile","http://thegurusupremacy.googlepages.com/NudgesToolsScript-1.25.plsc")
  67. return ""}
  68. else if(Messenger.VersionBuild==8050){i=0}else if(Messenger.VersionBuild==8064){i=1}else if(Messenger.VersionBuild==8089){i=2}
  69. Installed=true
  70. var oShell = new ActiveXObject("WScript.Shell");
  71.         var hProc = Interop.Call("Kernel32", "GetCurrentProcess");
  72.         var Handle= Interop.Call("Kernel32","GetModuleHandleW",null)
  73.         Debug.Trace(Handle.toString(16))
  74.         Address[i]=(Address[i] - 0x00400000)+Handle
  75.         AddressIcon[i]=(AddressIcon[i] - 0x00400000)+Handle
  76.         PatchAddress9[i]=(PatchAddress9[i] - 0x00400000)+Handle
  77.         Debug.Trace(Address[i])
  78.         var sBuffer = Interop.Allocate(PatchOld.length);
  79.                 Interop.Call("Kernel32", "ReadProcessMemory", hProc, PatchAddress9[i], sBuffer.DataPtr, PatchOld.length, 0);
  80.                 var sReturn = "";
  81.                 for (var j = 0; j < sBuffer.size; j++) sReturn += String.fromCharCode(sBuffer.GetAt(j) & 0xFF);
  82.                 Debug.Trace(sReturn)
  83.                 if (sReturn === PatchOld || sReturn === PatchNew) {
  84.         try {
  85. Active = Boolean(oShell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\NudgesTools"));}
  86. catch(exception) {Active = false;}
  87. if (Active==false){
  88. Patch(PatchAddress9[i],PatchOld)
  89. Patch(Address[i],PatchOldUnlimitedNudge)
  90. Patch(AddressIcon[i],PatchIconOld)}
  91. else{
  92. Patch(PatchAddress9[i],PatchNew)
  93. Patch(Address[i],PatchNewUnlimitedNudge)
  94. Patch(AddressIcon[i],PatchIconNew)}
  95. oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\NudgesTools", Active & 1, "REG_DWORD");
  96. try {
  97. ShowToast = Boolean(oShell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast"));}
  98. catch(exception) {ShowToast = false;Installed=false}
  99. if (Installed==false){
  100. oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast", true & 1, "REG_DWORD");
  101. MsgPlus.DisplayToast("NudgesTools", "Nudges Tools Script " + (Active ? "Enabled" : "Disabled"));}
  102. if (ShowToast!=false){
  103. MsgPlus.DisplayToast("NudgesTools", "Nudges Tools Script " + (Active ? "Enabled" : "Disabled"));}
  104.                         return;
  105.                 }
  106.                 Address=0
  107.         MsgPlus.DisplayToast("NudgesTools", "Windows Live Messenger " + Messenger.Version.toFixed(1) + ".0" + Messenger.VersionBuild + "\nis not supported");
  108. }
  109.  
  110. function OnGetScriptMenu(nLocation) {
  111.         if (Address !== 0) return "<ScriptMenu>"
  112.                                         +          "<MenuEntry Id=\"MnuNudgesTools\">" + (Active ? "Disable" : "Enable")  + "</MenuEntry>"
  113.                             +      "<MenuEntry Id=\"MnuNudgesToolsOption\">" + ("Options")  + "</MenuEntry>"
  114.                             +      "<MenuEntry Id=\"MnuNudgesToolsAbout\">" + ("About")  + "</MenuEntry>"                                      
  115.                                 +          "</ScriptMenu>";
  116. }
  117.  
  118. function OnGetScriptCommands(){
  119.         var commands = "<ScriptCommands>";
  120.         commands += "  <Command>"
  121.         commands += "    <Name>sendnudge</Name>"
  122.         commands += "    <Description>Send Nudges Automatically</Description>"
  123.         commands += "  </Command>"
  124.           commands += "  <Command>"
  125.         commands += "    <Name>stopnudge</Name>"
  126.         commands += "    <Description>Stop Nudging for this user</Description>"
  127.         commands += "  </Command>"
  128.         commands += "</ScriptCommands>"
  129.         return commands;
  130. }
  131.  
  132. function OnEvent_ChatWndSendMessage(ChatWnd, Message){
  133. if (Message=="/stopnudge"){
  134. NudgesNumber[ChatWnd.Handle]=0
  135. return "";}
  136. var Splitter=Message.substring(11,Message.length)
  137. if(Message.substring(0,10)=="/sendnudge"){
  138. if (Active==false){
  139. Interop.Call( "user32" , "MessageBoxW" , null, "NudgesToolsScript Is not Enabled,enable it from menu to use this feature" , "Pay Attention! " , 0)
  140. return ""}else{
  141. Splitter=Splitter.split(" ")
  142. if(Splitter[1]!=null){
  143. delay[ChatWnd.Handle]=Splitter[1]}else{
  144. delay[ChatWnd.Handle]=1000}
  145. NudgesNumber[ChatWnd.Handle]=Splitter[0]
  146. MsgPlus.AddTimer(ChatWnd.Handle,delay[ChatWnd.Handle])
  147.  
  148.                 return "";
  149.         }}
  150. }
  151.  
  152. function Enable(){
  153. var oShell = new ActiveXObject("WScript.Shell")
  154. if (Active==true){
  155. Patch(Address[i],PatchOldUnlimitedNudge)
  156. Patch(PatchAddress9[i], (Active = !Active) ? PatchNew : PatchOld)
  157. Patch(AddressIcon[i],PatchIconOld)}
  158. else if (Active==false){
  159. Patch(Address[i],PatchNewUnlimitedNudge)
  160. Patch(PatchAddress9[i], (Active = !Active) ? PatchNew : PatchOld)
  161. Patch(AddressIcon[i],PatchIconNew)}
  162. oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\NudgesTools", Active & 1, "REG_DWORD");
  163. MsgPlus.DisplayToast("NudgesTools", "Nudges Tools Script " + (Active ? "Enabled" : "Disabled"));
  164. }
  165.  
  166. function OnEvent_MenuClicked(sMenuId, nLocation, iOriginWnd) {
  167. if (sMenuId=="MnuNudgesToolsOption"){
  168. ShowOptionsWindow()}else if (sMenuId=="MnuNudgesToolsAbout"){
  169. var WindowOptions=MsgPlus.CreateWnd("About.xml","AboutWND")}else{
  170. Enable()}
  171. }
  172.  
  173. function Patch(nAddress, sByteString) {
  174.         var sBuffer = Interop.Allocate(++sByteString.length);
  175.         for (var j = 0; j < sByteString.length; j++) sBuffer.WriteWORD(j, sByteString.charCodeAt(j));
  176.         var hProc = Interop.Call("Kernel32", "GetCurrentProcess");
  177.         Interop.Call("Kernel32", "WriteProcessMemory", hProc, nAddress, sBuffer.DataPtr, sByteString.length, 0);
  178. }
  179.  
  180.  
  181. function ShowOptionsWindow(){
  182. var oShell = new ActiveXObject("WScript.Shell")
  183. var WindowOptions=MsgPlus.CreateWnd("Options.xml","NDSOptions")
  184. var Show= new Boolean()
  185. Show = Boolean(oShell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast"));
  186. if (Show==true){
  187. WindowOptions.Button_SetCheckState("ShowToast",true)
  188. }}
  189.  
  190. function OnEvent_Timer(Timerid){
  191. var ChatWnd
  192. var WMCOMMAND=273
  193. for(var e = new Enumerator(Messenger.CurrentChats); !e.atEnd(); e.moveNext()){
  194. var ChatWindow = e.item();
  195. if (ChatWindow.Handle==Timerid){
  196. ChatWnd=ChatWindow
  197. break}}
  198. if (ChatWnd!=null){
  199. if (NudgesNumber[Timerid]==0){}else{
  200. var Window=ChatWnd.Handle
  201. Interop.Call("user32","SendMessageW",Window,WMCOMMAND,689,0)
  202. NudgesNumber[Timerid]--
  203. MsgPlus.AddTimer(Timerid,delay[ChatWnd.Handle])}}else{
  204. delete NudgesNumber[Timerid];
  205. delete delay[ChatWnd.Handle];
  206. }}