
Open an email template

tony
If you want to provide an easy way for someone to contact you, this snippet aims to open an email template in the system default email program.
To use the code in a help file - which may be useful for developers to collect feedback - you would insert an action and define the action helper as the procedure file containing the ComposeAnEmail() function.
function Demo() NewPanel Button button1,pos={10,10},size={20,15},title="",Picture=ProcGlobal#pMail, Proc=ButtonProc Button button1,help={"Email the developer"} end function ButtonProc(STRUCT WMButtonAction &s) : ButtonControl if (s.eventCode == 2) // mouseup ComposeAnEmail() endif return 0 end function ComposeAnEmail([string user, string domain, string subject, string body]) domain = SelectString(ParamIsDefault(domain), domain, "uni-ingolstadt.de") user = SelectString(ParamIsDefault(user), user, "victor.frankenstein") subject = SelectString(ParamIsDefault(subject), subject, "Message from an Igor Pro user") body = SelectString(ParamIsDefault(body), body, "Type your message here") user = URLencode(user) domain = URLencode(domain) subject = URLencode(subject) body = URLencode(body) string cmd = "" sprintf cmd, "mailto:%s@%s?subject=%s&body=%s" user, domain, subject, body BrowseURL/Z cmd return V_flag end // PNG: width= 198, height= 48 Picture pMail ASCII85Begin M,6r;%14!\!!!!.8Ou6I!!!#=!!!!Q#R18/!(p&k=TAF%&TgHDFAm*iFE_/6AH5;7DfQssEc39jTBQ =U#;&M85u`*!mG5Nmir1#)n>FO/#6h#UA#F,q6:(,?!iI#lEYSod*Qq$@KU,Mh.,7X&l;B/R$c`uC# XWF=hJfM_\:TX.;b+[C^qj#rIg<`,cbt$BeAV:SrIbT9(Q#>B5PfiDUIc)O&-0Lb3$a5e5hC.+rV@6 ^0/&,k[^Wa9l-h$$ZA`TX$UG=:!)P;7!W9"9e'h6WLUj_Oo6Fpgein`uo_X&7//APB[9=85+oQk^&4 3%()H9]Gr0W(><)k65VL];q(IEYg?pGDp$2d"780!8uJ<W[&^lKf*V,Sq,TGqEDQN%B25dae7A=Cai ZIpeg(rJ&srr)`aHF6qqa,_<N(rk(?V8J6OL,E4HeR2\ST<@KY)u'+$U$F`pR7mU9jBl)m(A@LsVmb p&cC@fq4[!4hCFb]nE;I40UMN%V4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cJPU\g?dF)r"Erqq<i#d/>mMo*2hVJ2?#K$rD_oQn4@2CB3&=nX]? E&beeeeVS!?`.3\PtH,J_$u9)q`&0<.G89.ispi3I/3>E]M8`(\Cr\"=fBBFUQ?a8-48[<cZ+D_52O lVodhN:cd,mFURfM;nF5oYk_+<q'EGc.@)YhBk<4SbRCgLITr?T/F5>aHn)(m)IX[$SlZdl-"p"#Vl p-kJm-O)sh7Im6hogJ>\(dKafcFX#'U,55Yhq5pT?f/iLIHM!hIEcG(CVrnfJ=KW!PnBTKp>)G/-Ec t'Wg<qQES3=3&h=i>S!Z)e&9AMM5MbP;+"H_0`][8X(o$\:/4Q3),BsX!q<?&Hs#K)>f!']mdBKCG_ a/ZfQ#^&h0G$u0,.`Ij7"BO@71,"NLr2)J:`O9=?^Z?L_:%55B'!s"V&MW>T@0?&I"/\3224\L>uAu 9GgVr6/r-/.&3Ho3#9[ON,H+_j5]/jUS)&S3'KMq\(dIaDn"J\4:2uS*,b&GY-Ge+om/S\4iRBu4b1 qtihMB_L>pkBh?Eu8hr!Jdo[NGK]03i6&%B$WQ>KJf6,UQZH[GX%*S*4W8WlWBdt&p)q!d6p"\"rQg raq&jgT0cnG;tg8WosB_`+!^UR99,Wr`#4I%tKl$3^F)^QNS*!K@"elFLlt3U!s/Zj*VM#mJ-43I%E bBJu>jnq$91ctkUMrSVnNk:N%Dbhjtj\IP^eqr>^-hI?Q$?n`^\U(E941UVCaU*sP+(m%Xp'_np9]p ),863mU!#W;fO85*>XZqd=HI0bFd&-O08k,7-WNN/ui"G-:_s%e4X!WX&ILVtkTkdlepa2^+dUJ[$s 8LP8[OC]<_Cj+SNb2kC/Is%t+1ZB<6>dW*kh=EkH<Y\a%>gqO0!!!!j78?7R6=>B ASCII85End end
I haven't tested this much so I'd appreciate feedback on whether it works on various systems.
Works okay with Mac 11.7.9 (Big Sur) and Thunderbird.

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
You should be able to use BrowseURL instead of ExecuteScriptText. Inserting body text should be easy as well...just use something like
sprintf cmd, "mailto:%s@%s?subject=%s&body=%s" user, domain, subject, body
Each field (user, domain, subject, body) should likely be passed through URLEncode first. You are already encoding spaces in the subject but other non-ascii characters also need to be encoded.
IIRC, Gmail users will need to click a button in the location bar in order for mailto links to use Gmail.
February 23, 2024 at 01:19 pm - Permalink
Ah, thanks, I should have thought of that. BrowseURL makes it trivial.
February 24, 2024 at 01:26 am - Permalink