Code Execution Problem
- Posted by idget3 at netzero.net May 10, 2001
- 498 views
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> </DIV> <DIV><FONT color=3D#000000=20 <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>sequence FileTypes</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>FileTypes =3D{"Web Pager=20 Files",".WP"}</FONT></DIV> <DIV> </DIV> <DIV><FONT color=3D#000000 size=3D2>procedure = onClick_MenuOpen()</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>object temp</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2> = <BR> =20 integer handle<BR> sequence fName,=20 buffer<BR> object=20 data<BR> </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2> fName =3D = getOpenFileName( mainwin,=20 "", FileTypes )<BR> <BR> = if=20 length( fName ) =3D 0 then<BR> = return<BR> end if</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT><FONT color=3D#000000=20 size=3D2><BR> handle =3D open( fName, "r"=20 )<BR> buffer =3D=20 {}<BR> while 1=20 do<BR> &= nbsp; =20 data =3D gets(handle)<BR> if = atom(data)=20 then<BR>  = ;=20 exit<BR> end if</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> <FONT color=3D#000000=20 size=3D2> =20 <BR> buffer =3D buffer &=20 data</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> end = while</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> close( handle = )</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2><STRONG><FONT size=3D3><FONT = color=3D#ff0000>--=20 Problem: Execute code stored in=20 "buffer"</FONT><BR></FONT></STRONG> <BR>end=20 procedure<BR>onClick[ MenuOpen ] =3D routine_id( = "onClick_MenuOpen"=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