Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Tb6 parse error on email send (Read 2448 times)
Bill Anderson
Full Member
*
Offline



Posts: 7

Tb6 parse error on email send
Jun 27th, 2014, 9:00pm
 
I've been getting repeated parsing errors trying to send an email from Tinderbox. Finally, I've opened Mark Anderson's sendmail.tbx from this thread (referenced below), which works immediately.

If I take the same 3 notes and paste it in my Tb6 document, I get a parsing error.

Tb5 doc works when opened in Tb6. Same script does not work in a native Tb6 document.

Code:
$Result=runCommand("printf 'Subject: "+$Name+"' | sendmail -f "+$Email(Omnifocus)+" "+$Email(parent),); 



Thanks in advance,
Bill


http://www.eastgate.com/Tinderbox/forum//YaBB.pl?num=1263502659/8#8
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Tb6 parse error on email send
Reply #1 - Jun 28th, 2014, 4:49am
 
I'd hazard a guess it's the comma at the end which is inly needed if you're passing extra inputs. Also, I'd use $Email("Omnifocus") as the reference is a note name.  It's not needed in the second case as 'parent' is a designator and MB tells me it's better to leave designators unquoted as if in doubt TB will then pic the designator as the intended meaning over a note of the same name.

I'm just heading out, so I'm sorry I've not had a chance to test this. Anyway, I'd try losing the comma before the closing parenthesis
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Bill Anderson
Full Member
*
Offline



Posts: 7

Re: Tb6 parse error on email send
Reply #2 - Jun 28th, 2014, 10:19am
 
That code may be confusing, so let me try something simpler.

This returns the result ++ in the message body:
Code:
runCommand('printf +$Name+  | mail example@example.com')  



This returns +$Name+ in message body
Code:
runCommand("printf '+$Name+'  | mail example@example.com")  



This returns the first word of the note name in the message body:
Code:
runCommand('printf '+$Name+' | mail example@example.com')  



This fails to send:
Code:
runCommand('printf '"+$Name+"' | mail example@example.com')  



I've tried reversing the order ("printf... etc. to no avail.
How do I display the entire text of the $Name in my email?
Thanks!
Bill

Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Tb6 parse error on email send
Reply #3 - Jun 28th, 2014, 12:11pm
 
The second argument to runCommand() is evaluated and set to the standard input stdin.  So try

    runCommand("mail example@example.com",$Name)
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Tb6 parse error on email send
Reply #4 - Jun 28th, 2014, 12:13pm
 
Edit - I see MB also just posted, but now this is written, i'll leave it up as it shows issues to do with nesting quotes.

As a general principle, your quotes between + must match. Everything in red is one string literal [sic] so $Name is not evaluated:

runCommand('printf +$Name+  | mail example@example.com')  

Everything in red is one string literal [sic] so $Name is not evaluated:

runCommand("printf '+$Name+'  | mail example@example.com")  

Everything in red or blue is a discrete string literal [sic]. $Name should be evaluated:

runCommand('printf '+$Name+' | mail example@example.com')  

Everything in red, blue or green is a discrete string literal [sic]. $Name will not be evaluated:
runCommand('printf '"+$Name+"' | mail example@example.com')  

If you want the contents of $Name to be in in double quotes within the command line, you nest to nest the properly. So the opening double quote goes just before the closing single quote of the first string and the closing double quote just after the opening single quote of the second string. Thus:

runCommand('printf "'+$Name+'" | mail example@example.com')  

(Not tested live)
Back to top
 
« Last Edit: Jun 28th, 2014, 12:14pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Tb6 parse error on email send
Reply #5 - Jun 28th, 2014, 12:13pm
 
Similarly, if an adornment has the OnAdd action

   notify($Name)

then, when you drop a note onto the adornment, you get notified about the note’s name in the message center.
Back to top
 
 
WWW   IP Logged
Bill Anderson
Full Member
*
Offline



Posts: 7

Re: Tb6 parse error on email send
Reply #6 - Jun 30th, 2014, 9:39am
 
runCommand("mail example@example.com",$Name)
Heh. Wow. That is elegant. No wonder I'm an artist and not a programmer.

notify($Name)
That's really cool! This just keeps getting better and better.

but now this is written, i'll leave it up as it shows issues to do with nesting quotes.
Thanks Mark, this is particularly helpful.

Thank you both for your help. I have to say that the new Tb6 is just loads of fun to use!
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print