Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Dec 18, 2017 3:52 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Zip file attached to Mail with AppleScript gets corrupted
PostPosted: Fri Mar 22, 2013 1:56 am 
Offline
User avatar

Joined: Tue Sep 02, 2008 3:01 pm
Posts: 193
Location: Switzerland
In RS I compress a REALDatabase file using ZipMBS and save this file to the Documents folder. If I open this zip file manually, by double-clicking on it in Finder, then it unzips as expected. The Zip file is ok at this point of the process.

But in my RS program, I call an AppleScript to open Mail and attach the zip file to a new mail.

The Realbasic code:
Dim theSubject As String = "Backup of database " + dbFileNam
Dim theBody As String = "Database Last Modification Date : " + d.SQLDateTime
Dim theAttachment As String = SpecialFolder.Documents.Child(fName).NativePath
OSXSendMail(theSubject, theBody, theAttachment)

The AppleScript code:
on run {theSubject, theBody, theAttachment}
tell application "Mail"
set newMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theBody & return & return}
tell content of newMessage
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
activate
end tell
end run

It seems to work as expected, but when I drag the attachment to the desktop (or also into the Documents folder) then I can no longer unzip this file by simply doubleclicking it. The error:
Image

However, I got "The Archive Browser" from the AppStore and with that utility it is possible to safely extract the original file.

But I need a solution which does not require the user to purchase a third party expander for zip files.

Somehow the AppleScript seems to alter the attachment. So maybe someone knows a safe way of attaching a RealSQLDatabase file to a mail and send it?

_________________
"Stop deluding yourself with wishful thinking and find a solution that works for what you need to do"
Tim Hare - on forums.realsoftware.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Zip file attached to Mail with AppleScript gets corrupte
PostPosted: Fri Mar 22, 2013 4:41 am 
Offline

Joined: Fri Sep 30, 2005 10:01 am
Posts: 283
Location: Germany, Munich
Send me a sample of the original and the problematic zip files and I'll find out what makes the second one not unzip.

_________________
User of RB since first version. Provider of many free and outdated plugins.
Code for sharing: http://www.tempel.org/RB/Resources
Arbed, a unique tool for editing projects: http://www.tempel.org/Arbed
Zip compression classes: http://www.tempel.org/RB/ZipPackage


Top
 Profile  
Reply with quote  
 Post subject: Re: Zip file attached to Mail with AppleScript gets corrupte
PostPosted: Fri Mar 29, 2013 5:10 am 
Offline
User avatar

Joined: Tue Sep 02, 2008 3:01 pm
Posts: 193
Location: Switzerland
tempel wrote:
Send me a sample of the original and the problematic zip files and I'll find out what makes the second one not unzip.
Done! Thanks a lot!

_________________
"Stop deluding yourself with wishful thinking and find a solution that works for what you need to do"
Tim Hare - on forums.realsoftware.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Zip file attached to Mail with AppleScript gets corrupte
PostPosted: Fri Mar 29, 2013 12:00 pm 
Offline

Joined: Mon Feb 20, 2006 11:21 am
Posts: 21
I've run into something similar to this before where the solution ended up being a force quite of the appleeventsd process. I think the built in tool makes use of apple events as part of it's method of unzipping, and if that daemon gets hosed for some reason it won't work.

The times I've run into this it's been related to doing some scripting work with the AppleScript Editor, so it's a bit similar to your situation I think.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group