Linking app to email

hellooo!
I need to know if It’s possible to share images saved in codea by email!
Does SQL work with codea??

I think the closest you could get is putting the image in the clipboard, and then opening Mail using the URL-schema. I forget exactly what it would be OpenURL("mail//:") or something like that. If you search the forum for URL schema, there’s a post that lists the schemas for various iOS apps.

thank youu very muchh

I searched as you said! I found an app under the namer of “power of url”.
The example concerning email gives you the chance to aend an email!
Nothing said about the contents of the email.
Can anyone help?
@yojimbo2000

@calinefrangieh Anything here that can help you.

function setup()
    to = "someone@email.com"
    cc = "copy@email.com"
    subject = "This is the subject"
    
    str1="this is the first line"
    str2="\
       this is the second line"
    str3="\
       this is the third line"
    message=str1..str2..str3
    
    create(to, cc, subject, message)
end

function create(to, cc, subject, body)
    url = "mailto:"..to.."?cc="..cc.."&subject="..code1(subject).."&body="..code1(body)
    openURL(url)
end

function code1(str)
    crlf = "%a%d-_.~"
    return string.gsub(str, "[^"..crlf.."]", code2)
end

function code2(c)
    return string.format ("%%%02X", string.byte(c))
end

This was the page I was thinking of, with the various schemas.

https://codea.io/talk/discussion/1123/the-power-of-openurl

On a side-note, if the target app supports the X-callback URL, scheme, then you can do all sorts of things.

Codea also has an openURL, though it’s not exposed (which is why it just looks like gibberish, instead of codea:// or whatever, and won’t work as a link in Safari). It’s:

db-cj1xdlcmftgsyg1://

If the URL schema supports callbacks, you can use the above to “return to Codea” after whatever action it is has been completed. This is how I get the app Working Copy to wake up its WebDAV server, and then return to Codea once it’s done that.

Combined with iOS automation apps like Workflow or whatever, you can get quite a lot done.

@yojimbo2000, is WebDAV really a server? I thought it’s something else

@dave what is the meaning %a%d-_.~ and %%%02X

@yojimbo2000 i’ve tried to call codea from pythonista with

f = urllib.urlopen("db-cj1xdlcmftgsyg1://", params)

but i get an ‘unknown url error’. Any suggestion?
Thanks!
PS: it was a direct call, not a callback. Is it the reason for the error?

@Jmv38 yeah, TBH the URL should just be a clickable link (the public URL schema ones are). Perhaps this one isn’t because it’s not “exposed”. But it does work as a callback with x-callback urls (using the &x-success= parameter).

@calinefrangieh The %a%d turns into a carriage return, line feed and the %%%02X turns in %02X which is used to create a hex value. You really don’t need to worry about them cause they won’t change.

Thank you!!!