Trying to write on a .txt file |
Author: |
Message: |
iklipxe
New Member
Posts: 4
Joined: Jan 2008
|
O.P. Trying to write on a .txt file
Hello,
first sorry my english (i'm portuguese)
I have this code:
code: function AddLineToFile(file, line)
{
if (!fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file))
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 1);
else
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 8, 0);
fileObj.WriteLine(line);
fileObj.Close();
}
that i took from here
and in the debug it say's that fsObj doesn't exist what am i doing wrong?
|
|
01-13-2008 09:24 PM |
|
|
Dheano
New Member
I shall overcome
Posts: 11
31 / /
Joined: Dec 2007
|
RE: Trying to write on a .txt file
Are you selecting "All Files" when saving, then naming it *.js ?
|
|
01-13-2008 09:46 PM |
|
|
roflmao456
Skinning Contest Winner
Posts: 955 Reputation: 24
30 / /
Joined: Nov 2006
Status: Away
|
RE: Trying to write on a .txt file
add at the top:
code: var fsObj = new ActiveXObject("Scripting.FileSystemObject");
[quote]
Ultimatess6: What a noob mod
|
|
01-13-2008 09:51 PM |
|
|
iklipxe
New Member
Posts: 4
Joined: Jan 2008
|
O.P. RE: Trying to write on a .txt file
thanks roflmao456 it works
|
|
01-13-2008 09:53 PM |
|
|
iklipxe
New Member
Posts: 4
Joined: Jan 2008
|
O.P. RE: Trying to write on a .txt file
btw what's wrong here:
code: <?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsichemaLocation="urn:msgplus:interface PlusInterface.xsd" Name="Demo Script Windows">
<Window Id="windowZero" Version="1">
<Position Width="114" Height="128" />
<Attributes>
<Caption>Test Window</Caption>
</Attributes>
<TitleBar>
<Title><Text>Hello!</Text></Title>
</TitleBar>
<Controls>
<Control xsi:type="ListBoxControl" Id="list">
<Position Top="37" Width="0" Left="26" />
</Control>
<Control xsi:type="ButtonControl" Id="btnAdd">
<Position Top="37" Width="0" Left="26" />
<Caption>Adicionar</Caption>
</Control>
<Control xsi:type="ButtonControl" Id="btnRem">
<Position Top="80" Width="0" Left="190" />
<Caption>Remover</Caption>
</Control>
<Control xsi:type="StaticControl" Id="static1">
<Position Top="37" Width="0" Left="26" />
<Caption>Made by zeroonnet</Caption>
</Control>
</Controls>
</Window>
</Interfaces>
i use var Wnd = MsgPlus.CreateWnd("zero.xml", "windowZero"); to open but nothing append's
|
|
01-13-2008 10:42 PM |
|
|
davidpolitis
Full Member
Posts: 371 Reputation: 16
Joined: Aug 2006
|
RE: RE: Trying to write on a .txt file
quote: Originally posted by iklipxe
code: <?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd" Name="Demo Script Windows">
<Window Id="windowZero" Version="1">
<Position Width="114" Height="128" />
<Attributes>
<Caption>Test Window</Caption>
</Attributes>
<TitleBar>
<Title><Text>Hello!</Text></Title>
</TitleBar>
<Controls>
<Control xsi:type="ListBoxControl" Id="list">
<Position Top="37" Width="0" Left="26" />
</Control>
<Control xsi:type="ButtonControl" Id="btnAdd">
<Position Top="37" Width="0" Left="26" />
<Caption>Adicionar</Caption>
</Control>
<Control xsi:type="ButtonControl" Id="btnRem">
<Position Top="80" Width="0" Left="190" />
<Caption>Remover</Caption>
</Control>
<Control xsi:type="StaticControl" Id="static1">
<Position Top="37" Width="0" Left="26" />
<Caption>Made by zeroonnet</Caption>
</Control>
</Controls>
</Window>
</Interfaces>
Change the positioning and remove all instances of Width="0"?
This post was edited on 01-14-2008 at 04:41 AM by davidpolitis.
|
|
01-14-2008 04:36 AM |
|
|
roflmao456
Skinning Contest Winner
Posts: 955 Reputation: 24
30 / /
Joined: Nov 2006
Status: Away
|
RE: Trying to write on a .txt file
open the file in notepad, and press File > Save As
then in the Encoding dropdown box, you select Unicode
[quote]
Ultimatess6: What a noob mod
|
|
01-14-2008 01:10 PM |
|
|
iklipxe
New Member
Posts: 4
Joined: Jan 2008
|
O.P. RE: Trying to write on a .txt file
i've saved with unicode and removed the width="0" and the window apears without controls
code: <?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsichemaLocation="urn:msgplus:interface PlusInterface.xsd" Name="Demo Script Windows">
<Window Id="windowZero" Version="1">
<Position Width="114" Height="128" />
<Attributes>
<Caption>Test Window</Caption>
</Attributes>
<TitleBar>
<Title><Text>Hello!</Text></Title>
</TitleBar>
<Controls>
<Control xsi:type="ListBoxControl" Id="list">
<Position Top="37" Left="26" />
</Control>
<Control xsi:type="ButtonControl" Id="btnAdd">
<Position Top="37" Left="26" />
<Caption>Adicionar</Caption>
</Control>
<Control xsi:type="ButtonControl" Id="btnRem">
<Position Top="80" Left="190" />
<Caption>Remover</Caption>
</Control>
<Control xsi:type="StaticControl" Id="static1">
<Position Top="37" Left="26" />
<Caption>Made by zeroonnet</Caption>
</Control>
</Controls>
</Window>
</Interfaces>
What's wrong?
|
|
01-14-2008 10:57 PM |
|
|
pollolibredegrasa
Full Member
formerly fatfreechicken
Posts: 483 Reputation: 34
35 / /
Joined: May 2005
|
|
01-14-2008 11:17 PM |
|
|
|