user objects

This forum is for discussing Mailtraq's Scripting features. Get help with Mailtraq scripts, templates and external ActiveX scripting.

user objects

Postby shonuff » Mon Jun 08th, 2009 6:40pm

can someone please tell me y this script is not working!!!!!!!!

// New Script
// Lines beginning with double forward slashes are commentsuser


//Create file
myfile := CreateFile("E:\Mailtraq\database\scripts\text.txt");
Write(myfile, "open file");


//create user object
user := Server.Config.GetUser("wallace.rutledge");
write(myfile, "create user object");


//write out user name
write(myfile, "my name is -> " + user.Name);


//close file
write(myfile, "Close file");
CloseFile(myfile)

///////////////////// OutPut /////////////////////////
open file
create user object
my name is ->
Close file
///////////////////////////////////////////////////////
shonuff
 
Posts: 6
Joined: Mon Jun 08th, 2009 6:36pm

Re: user objects

Postby Elric Pedder » Mon Jun 08th, 2009 10:08pm

This looks like you are mixing two different scripting languages. Try doing it all in Javascript

Code: Select all
<@LANGUAGE=Javascript@>
<%
var fso = new ActiveXObject("Scripting.FileSystemObject");

// create file
var myfile = fso.CreateTextFile("E:\\Mailtraq\\database\\scripts\\text.txt");
myfile.WriteLine("open file");

// create user object
var user = Config.GetUser("wallace.rutledge");
myfile.WriteLine("create user object");

//write out user name
myfile.WriteLine("my name is -> " + user.Name);

//close file
myfile.WriteLine("Close file");
myfile.Close();
%>


I'm assuming you are using this script inside Mailtraq. Also, make sure the very first line is <@LANGUAGE=Javascript@> otherwise Mailtraq will think it is MailtraqScript.
Mailtraq Development and Escalation Support
Novitraq Incorporated
User avatar
Elric Pedder
Mailtraq Escalation Support
 
Posts: 2675
Joined: Tue Nov 23rd, 2004 1:16pm
Location: Montreal, Canada

Re: user objects

Postby shonuff » Tue Jun 09th, 2009 9:56am

thank you!!!!!!!!!!!!!!!!

that was alsome, it worked like a charm, can you tell me what i was doing wrong in the mailtraq script.
shonuff
 
Posts: 6
Joined: Mon Jun 08th, 2009 6:36pm

Re: user objects

Postby Elric Pedder » Tue Jun 09th, 2009 12:48pm

Mailtraq has two scripting systems: the original MailtraqScript and the newer ActiveScripting system. Your script was MailtraqScript except for Server.Config.GetUser("wallace.rutledge") and user.Name which are part of ActiveScripting.
Mailtraq Development and Escalation Support
Novitraq Incorporated
User avatar
Elric Pedder
Mailtraq Escalation Support
 
Posts: 2675
Joined: Tue Nov 23rd, 2004 1:16pm
Location: Montreal, Canada


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron