What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » activex help

activex help
Author: Message:
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. Huh?  activex help
i have a window with a button save and when you click on it the values of 2 editcontrols  should be saved to tewo different textfiles and the window shoulkd close i don't understand how i should do this so plz help

This post was edited on 01-03-2007 at 01:59 PM by Wakaki.
[Image: wakakipt2.png]
01-03-2007 10:58 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: activex help
Use the FileSystemObject! :)
code:
Original from MPScripts.net
// Writes content over an existing text file (replace the current text with new text)
function OverwriteFile (file, content) {
  var fileObj = new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 0);
  fileObj.Write(content);
  fileObj.Close();
}

Use that function to write the content, like:
code:
OverwriteFile("file1.txt", PlusWnd.GetControlText("EdtThing1");
OverwriteFile("file2.txt", PlusWnd.GetControlText("EdtThing2");

If you need a function to read the contents again:
code:
Original from MPScripts.net
// Reads the full contents of a text file to a variable
function ReadFile (file) {
  var fileObj = new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 1);
  var contents = fileObj.ReadAll();
  fileObj.Close();
  return contents;
}

* Matti (L) the MP!L Script Developers Resource... thanks Dempsey!

This post was edited on 01-03-2007 at 05:11 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-03-2007 04:15 PM
Profile E-Mail PM Web Find Quote Report
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. RE: activex help
thank you very much mattike but i only must happen when they press the button save
[Image: wakakipt2.png]
01-03-2007 04:40 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: activex help
Well, then place it in an OnWindowidEvent_CtrlClicked event!
code:
// Writes content over an existing text file (replace the current text with new text)
function OverwriteFile (file, content) {
  var fileObj = new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 0);
  fileObj.Write(content);
  fileObj.Close();
}

function OnWindowidEvent_CtrlClicked(PlusWnd, CtrlId) {
  if(CtrlId == "BtnSave") {
    OverwriteFile("file1.txt", PlusWnd.GetControlText("EdtThing1");
    OverwriteFile("file2.txt", PlusWnd.GetControlText("EdtThing2");
  }
}

This post was edited on 01-03-2007 at 05:11 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-03-2007 05:10 PM
Profile E-Mail PM Web Find Quote Report
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. RE: activex help
thank you mattike
i've done this and then i get that i don't have prvileges so my script isn't started:S:S:S:S:S:S plz help
[Image: wakakipt2.png]
01-03-2007 05:21 PM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: activex help
try posting your code (or debug window of the error ) :gfdrin:
[quote]
Ultimatess6
: What a noob mod
01-03-2007 11:28 PM
Profile PM Web Find Quote Report
Wakaki
Junior Member
**

Avatar

Posts: 30
31 / Male / –
Joined: Jan 2007
O.P. RE: activex help
i was baout to do right now when i read your reply:P

EDIT: when i was cpying i discovered the fault:P bit silly when you look above in this thread and see the code mattike gave to me? then you see
code:
// + "file"
and then in the ctrlclicked function you see
code:
("myfile.txt", .......

and silly me made it :
code:
("//myfile.txt"......


so that was the error cause the script thought :
code:
////myfile.txt



thank you al for replying

This post was edited on 01-04-2007 at 10:03 AM by Wakaki.
[Image: wakakipt2.png]
01-04-2007 09:59 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On