Re: Code Execution Problem

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

This is a multi-part message in MIME format.

------=_NextPart_000_002A_01C0D9B2.9EC9B840
	charset="iso-8859-1"

Just a suggestion . . .  I recommend using the API calls for =
input/output to files . . .  Some combatibility issues with Win2000 . . =
. In theory, if you use API calls, you can be rest assured that your =
program won't break down the road, in theory of course  . . .
  ----- Original Message -----=20
  From: idget3 at netzero.net=20
  To: EUforum=20
  Sent: Thursday, May 10, 2001 7:57 AM
  Subject: Code Execution Problem



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

  procedure onClick_MenuOpen()

  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

      end while

      close( handle )

  -- Problem: Execute code stored in "buffer"
   =20
  end procedure
  onClick[ MenuOpen ] =3D routine_id( "onClick_MenuOpen" )

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


------=_NextPart_000_002A_01C0D9B2.9EC9B840
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3Diso-8859-1>
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Just a suggestion . . .&nbsp; I =
recommend using the=20
API calls for input/output to files . . .&nbsp; Some combatibility =
issues with=20
Win2000 . . . In theory, if you use API calls, you can be rest assured =
that your=20
program won't break down the road, in theory of course &nbsp;. . =
.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Didget3 at netzero.net=20
  href=3D"mailto:idget3 at netzero.net">idget3 at netzero.net</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DEUforum at topica.com=20
  href=3D"mailto:EUforum at topica.com">EUforum</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Thursday, May 10, 2001 =
7:57=20
AM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Code Execution =
Problem</DIV>
<A =
writing=20
  to a file using puts(). It writes setText(variable,text). When it =
opens, it=20
  reads the code, saves the code to a variable, then it's supposed to =
execute=20
  the code. But I don't know how to execute the code stored in the =
variable.=20
  Will someone please tell me how?</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT color=3D#000000 <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{"Web Pager=20
  Files",".WP"}</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
  "", FileTypes )<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; if =
length( fName=20
  ) =3D 0 then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  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, "r"=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 =

  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer =3D buffer &amp; =

  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=20
)</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 =
"buffer"</FONT><BR></FONT></STRONG>&nbsp;=20
  <BR>end procedure<BR>onClick[ MenuOpen ] =3D routine_id( =
"onClick_MenuOpen"=20
Wanna Throw That PC Out the Window?
Not yet. First, check our technology forum for help.
<A =
href=3D"http://topica.com/u/?b1dd66.b2A1yr">http://topica.com/u/?b1dd66.b=
2A1yr</A>
Or send an email To: EUforum-unsubscribe at topica.com
This email was sent to: jjnick at cvn.com

<A =

------=_NextPart_000_002A_01C0D9B2.9EC9B840--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu