Code Execution Problem

new topic     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.

------=_NextPart_000_0011_01C0D926.CB7C9CE0
	charset="iso-8859-1"

Hello, my name is Trevor. I am a twelve year old programmer who isn't as =
good at it as you guys. I am trying to make a program that will open a =
saved file in win32lib.ew. It saves by just writing to a file using =
puts(). It writes setText(variable,text). When it opens, it reads the =
code, saves the code to a variable, then it's supposed to execute the =
code. But I don't know how to execute the code stored in the variable. =
Will someone please tell me how?


sequence FileTypes
FileTypes =3D{"Web Pager Files",".WP"}
=20
procedure onClick_MenuOpen()
=20
object temp
   =20
    integer handle
    sequence fName, buffer
    object data
   =20
   fName =3D getOpenFileName( mainwin, "", FileTypes )
   =20
    if length( fName ) =3D 0 then
        return
    end if

    handle =3D open( fName, "r" )
        buffer =3D {}
    while 1 do
               data =3D gets(handle)
        if atom(data) then
            exit
        end if
        =20
        buffer =3D buffer & data
=20
    end while
=20
    close( handle )
=20
-- Problem: Execute code stored in "buffer"
 =20
end procedure
onClick[ MenuOpen ] =3D routine_id( "onClick_MenuOpen" )

------=_NextPart_000_0011_01C0D926.CB7C9CE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<DIV><FONT color=3D#000000 size=3D2>Hello, my name is Trevor. I am a =
twelve year old=20
programmer who isn't as good at it as you guys. I am trying to make a =
program=20
that will open a saved file in win32lib.ew. It saves by just writing to =
a file=20
using puts(). It writes setText(variable,text). When it opens, it reads =
the=20
code, saves the code to a variable, then it's supposed to execute the =
code. But=20
I don't know how to execute the code stored in the variable. Will =
someone please=20
tell me how?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000=20

<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>sequence FileTypes</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>FileTypes =3D{&quot;Web Pager=20
Files&quot;,&quot;.WP&quot;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>procedure =
onClick_MenuOpen()</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>object temp</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp;&nbsp; =
<BR>&nbsp;&nbsp;&nbsp;=20
integer handle<BR>&nbsp;&nbsp;&nbsp; sequence fName,=20
buffer<BR>&nbsp;&nbsp;&nbsp; object=20
data<BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp; fName =3D =
getOpenFileName( mainwin,=20
&quot;&quot;, FileTypes )<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; =
if=20
length( fName ) =3D 0 then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

return<BR>&nbsp;&nbsp;&nbsp; end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20
size=3D2><BR>&nbsp;&nbsp;&nbsp; handle =3D open( fName, &quot;r&quot;=20
)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer =3D=20
{}<BR>&nbsp;&nbsp;&nbsp; while 1=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
data =3D gets(handle)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =
atom(data)=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
exit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;<FONT color=3D#000000=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer =3D buffer &amp;=20
data</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp;&nbsp; end =
while</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp;&nbsp; close( handle =
)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2><STRONG><FONT size=3D3><FONT =
color=3D#ff0000>--=20
Problem: Execute code stored in=20
&quot;buffer&quot;</FONT><BR></FONT></STRONG>&nbsp; <BR>end=20
procedure<BR>onClick[ MenuOpen ] =3D routine_id( =
&quot;onClick_MenuOpen&quot;=20

------=_NextPart_000_0011_01C0D926.CB7C9CE0--


NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu