Shoutbox

Trying to write on a .txt file - 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: Trying to write on a .txt file (/showthread.php?tid=80914)

Trying to write on a .txt file by iklipxe on 01-13-2008 at 09:24 PM

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 :S what am i doing wrong?
RE: Trying to write on a .txt file by Dheano on 01-13-2008 at 09:46 PM

Are you selecting "All Files" when saving, then naming it *.js ?


RE: Trying to write on a .txt file by roflmao456 on 01-13-2008 at 09:51 PM

add at the top:

code:
var fsObj = new ActiveXObject("Scripting.FileSystemObject");

RE: Trying to write on a .txt file by iklipxe on 01-13-2008 at 09:53 PM

thanks roflmao456 it works :P


RE: Trying to write on a .txt file by iklipxe on 01-13-2008 at 10:42 PM

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" 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>

i use var Wnd = MsgPlus.CreateWnd("zero.xml", "windowZero"); to open but nothing append's :S
RE: RE: Trying to write on a .txt file by davidpolitis on 01-14-2008 at 04:36 AM

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"?
RE: Trying to write on a .txt file by roflmao456 on 01-14-2008 at 01:10 PM

open the file in notepad, and press File > Save As

then in the Encoding dropdown box, you select Unicode


RE: Trying to write on a .txt file by iklipxe on 01-14-2008 at 10:57 PM

i've saved with unicode and removed the width="0" and the window apears without controls :S

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" 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?
RE: RE: Trying to write on a .txt file by pollolibredegrasa on 01-14-2008 at 11:17 PM

quote:
Originally posted by iklipxe
i've saved with unicode and removed the width="0" and the window apears without controls :S
Put the widths back in and give them a proper value (something above 0). Having them all set at 0 means just that; they have no width so you wont see anything :P