This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
sample_code:backup_apps [2015/01/11 23:46] stevegarman simplified regex |
sample_code:backup_apps [2015/11/15 00:00] (current) |
||
---|---|---|---|
Line 5: | Line 5: | ||
If you wish, you can save the mail as a draft, rather than sending it. | If you wish, you can save the mail as a draft, rather than sending it. | ||
+ | |||
+ | Or instead of choosing a mail app to send the file, you may be able to choose an archiving app that is on your device, such as **Google Drive**. | ||
<code JavaScript archive.js> | <code JavaScript archive.js> | ||
- | var mygmail = "my.own.address@gmail.com" | + | var mygmail = app.GetUser(); |
+ | var txt, | ||
// | // | ||
Line 13: | Line 16: | ||
{ | { | ||
// | // | ||
- | lay = app.CreateLayout( " | + | var lay = app.CreateLayout( " |
Line 36: | Line 39: | ||
var zip = app.CreateZipUtil(); | var zip = app.CreateZipUtil(); | ||
var fldr = "/ | var fldr = "/ | ||
- | var archname = (new Date).toISOString().slice(0, | + | archname = (new Date).toISOString().slice(0, |
archname = " | archname = " | ||
archname = archname.replace(/ | archname = archname.replace(/ | ||
- | var file = archfolder+archname+" | + | archname += " |
+ | var file = archfolder+archname; | ||
+ | archname = app.GetModel()+"/"+archname; | ||
zip.Create( file ); | zip.Create( file ); | ||
Line 71: | Line 76: | ||
{ | { | ||
var fname = yesNo.fname; | var fname = yesNo.fname; | ||
- | app.SendMail( mygmail, | + | app.SendMail( mygmail, |
} | } | ||
} | } | ||
- | |||
</ | </ | ||
===== Warnings ===== | ===== Warnings ===== | ||
- | ==== Personalise the code ==== | ||
- | You must change the email address in the first line | ||
==== Version required ==== | ==== Version required ==== | ||
This code makes the assumption that you are using at least version 1.15 of DroidScript, | This code makes the assumption that you are using at least version 1.15 of DroidScript, |