Open Closed Stack Still in Memory

2000-07-16 Thread Sivakatirswami

Aloha,

Opening downloaded a closed stack in memory (i.e. not destroyed) that was
downloaded but never saved to disk has some unusual behavior.

Scenario: 
-- Boot Stack A, 
-- Button in Stack A downloads Stack "Portal" from the web
-- Stack "Portal" has a button that downloads Stack C and then closes itself
 (but stack "Portal" is never saved to disk)
-- We want stack C to auto open stack "Portal"  when it closes
According to documentation, Stack "Portal" is still in memory if not
destroyed. . .

But   
on closeStack
open stack "Portal" #using the stack's filename
end closeStack

Doesn't open it. One could presume this is because it was never saved to
disk and therefore has no path as such. Is there a way around this?
  Also I close stack "Portal" but not destroy it and then download stack
"Portal" again, I don't get any message telling me that Stack B is already
in Memory and if I want to purge the previous one or not. . .

But then I solved the problem by
a) not unloading Stack "Portal" after it arrived
b) storing the hRef of the Stack "Portal" into a global gPortalhRef
c) closing Stack "Portal"
(one could also query the cachedURLs)

Now, we can re-open stack portal anytime (assuming we never exit) with:

global gPortalhRef
on mouseUp
  go  url gPortalhRef
end mouseUp

OK, fine, but can someone explain the two different behaviours in more
explicit terms? Is there a way to go to the cached stack more directly? One
would rather not have to globals or keep having to query the cachedURLs,
although that is certainly doable if it is the only way. Is stack "Portal"
in memory or not? Is the http "cache" in a different place in MC's heap
space? Or is it placed in a ram sector outside of MC's heap space? The
second issue (besides direct access to open the stack from memory) being how
far can you go with this before you better make sure you start unloading
some URL's .

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
www.HinduismToday.com
[EMAIL PROTECTED]


Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: Emailing an attachment

2000-07-16 Thread Raymond E. Griffith

on 7/16/2000 1:11 PM, andu [EMAIL PROTECTED] tried to help me with my
problem below:

 
 I am trying to send an attachment file with the mcmail.mc file. So far, this
 is what I have done:
 
 I put a field "theAttachment" into the card. The script is from the button
 "Send", with my addition clearly marked.
 
 It does something, but it doesn't place it as an attachment, but as a part
 of the body text.
 
 
 # construct email header
 put "" into mailraw
 put "From: " fld "mailfrom"  crlf after mailraw
 put "Date: " mimedate()  crlf after mailraw
 put "Content-Type: text/plain; charset=us-ascii" crlf after mailraw
 put "MIME-Version: 1.0" crlf after mailraw
 put "Message-Id: " the seconds "-" the ticks "@MetaCardSMTP"  crlf
 after mailraw
 put "To: " fld "to"  crlf after mailraw
 if fld "cc"  "" then
 put "CC: " fld "cc"  crlf after mailraw
 end if
 put "Subject: " fld "subject"  crlf after mailraw
 put crlf  fld "body" after mailraw
 
 
 -- ** MY ADDITION
 if fld "theAttachment" is not empty then
 put fld "theAttachment" into theAttachmentName
 
 Try 
 put url "binfile:"   theAttachmentName into theattachment
 put crlf  "Content-Type: application/base64; name="  quote  \
 theAttachmentName  quote after mailraw
 put crlf  crlf  base64Encode(theattachment) after mailraw
 

I tried it. Still doesn't work. It does do something different, though (I'm
not sure exactly why...). It seems to encode the name, but not the file.

But thanks. Still working on it. Any other suggestions?

 put "binfile:"  theAttachmentName into theattachment
 put crlf  "Content-Type: application/base64; name="  quote 
 theattachment  quote after mailraw
 put crlf  crlf  base64Encode(url theAttachment) after mailraw
 end if
 --
 
 
 # socket implementation, talking to smtp
 smtpsend fld "smtpserver",fld "mailfrom",validEmailList,mailraw
 end composemail
 
 
 --
 
 I sent the file (a MetaCard file) to myself. I copied and pasted the encoded
 data in my email into a MC field. A button has the following script:
 
 on mouseUp
 ask file "What file to save to?"
 put it into thefileName
 put base64Decode(field "thebinfile") into URL thefileName
 end mouseUp
 
 But now, when I attempt to open the file (type into the message box "Answer
 file "?"; open it), I get the message "stack was corrupted by a non-binary
 file transfer"
 
 -
 
 So, any suggestions? I really *need* to be able to send file attachments
 with this MCmail protocol. I am building an app that will generate a MC
 stack, then email it to the appropriate person.
 
Thanks for your help,
 
Raymond
 


Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: Emailing an attachment

2000-07-16 Thread LiangTyan Fui

On 17/7/00 2:40 AM, Raymond E. Griffith wrote:

 on 7/16/2000 1:11 PM, andu [EMAIL PROTECTED] tried to help me with my
 problem below:
 
 
 I am trying to send an attachment file with the mcmail.mc file. So far, this
 is what I have done:
 
 I put a field "theAttachment" into the card. The script is from the button
 "Send", with my addition clearly marked.
 
 It does something, but it doesn't place it as an attachment, but as a part
 of the body text.
 
 
 # construct email header
 put "" into mailraw
 put "From: " fld "mailfrom"  crlf after mailraw
 put "Date: " mimedate()  crlf after mailraw
 put "Content-Type: text/plain; charset=us-ascii" crlf after mailraw

You have to change the above line to something like:
put "Content-Type: multipart/mixed; boundary=" quote \
"TheMailBoundary" quote  crlf after mailraw

 put "MIME-Version: 1.0" crlf after mailraw
 put "Message-Id: " the seconds "-" the ticks "@MetaCardSMTP"  crlf
 after mailraw
 put "To: " fld "to"  crlf after mailraw
 if fld "cc"  "" then
 put "CC: " fld "cc"  crlf after mailraw
 end if
 put "Subject: " fld "subject"  crlf after mailraw
 put crlf  fld "body" after mailraw

Add the following here into the body:
put "--TheMailBoundary" crlf \
"Content-Type: text/plain; charset=us-ascii" crlf  crlf after mailraw

You may continue with your normal text mail body.

And finally add the following for your attachment:
# the attachment header
put "--TheMailBoundary" crlf \
"Content-Type: application/base64; charset=us-ascii" crlf \
"Content-Disposition: attachment; filename=" quote  \
theAttachmentName  quote  crlf \
   "Content-Transfer-Encoding: base64" crlf  crlf after mailraw
# the attachment base64 code
put base64Encode(theattachment)  crlf after mailraw
# closing the email
put "--TheMailBoundary--" after mailraw
  
 -- ** MY ADDITION
 if fld "theAttachment" is not empty then
 put fld "theAttachment" into theAttachmentName
 
 Try 
 put url "binfile:"   theAttachmentName into theattachment
 put crlf  "Content-Type: application/base64; name="  quote  \
 theAttachmentName  quote after mailraw
 put crlf  crlf  base64Encode(theattachment) after mailraw
 
 
 I tried it. Still doesn't work. It does do something different, though (I'm
 not sure exactly why...). It seems to encode the name, but not the file.

The point here is to create a multipart MIME mail. If you refuse to read RFC
document, you can just grab a sample source of email with attachment.
Note that used of static "TheMailBoundary" here wasn't a good idea, you
should change it to a random generated string.

I have tried the code, so be careful.
Hope this helps.

Regards,
LiangTyan Fui


 But thanks. Still working on it. Any other suggestions?
 
 put "binfile:"  theAttachmentName into theattachment
 put crlf  "Content-Type: application/base64; name="  quote 
 theattachment  quote after mailraw
 put crlf  crlf  base64Encode(url theAttachment) after mailraw
 end if
 --
 
 
 # socket implementation, talking to smtp
 smtpsend fld "smtpserver",fld "mailfrom",validEmailList,mailraw
 end composemail
 
 
 --
 
 I sent the file (a MetaCard file) to myself. I copied and pasted the encoded
 data in my email into a MC field. A button has the following script:
 
 on mouseUp
 ask file "What file to save to?"
 put it into thefileName
 put base64Decode(field "thebinfile") into URL thefileName
 end mouseUp
 
 But now, when I attempt to open the file (type into the message box "Answer
 file "?"; open it), I get the message "stack was corrupted by a non-binary
 file transfer"
 
 -
 
 So, any suggestions? I really *need* to be able to send file attachments
 with this MCmail protocol. I am building an app that will generate a MC
 stack, then email it to the appropriate person.
 
 Thanks for your help,
 
 Raymond


Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.