Welcome, Guest. Please Login or Register.
eccoMAGIC Forums
05/05/24 at 03:36:11
News: If you outline, checkout the new outlineZOOM extension. Amazing stuff to instantly bring your ideas into focus.
Home Help Search Login Register


Pages: 1 
Send Topic Print
MagicMerge trigger LUA rule or vice versa? (Popularity: 27779 )
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post MagicMerge trigger LUA rule or vice versa?
11/14/08 at 13:15:02
 
I am considering using Magic Merge to send out E-mails to several recipients.
I would like to create a subitem for all people to which an E-mail was sent. This is easy to do with LUA rules.
 
1. However, I would like the LUA rule to be triggered after doing the Merge. Is this possible?
 
2. Alternatively, can I trigger the Merge from a LUA command somehow..?
 
3. Third possibility would be for MagicMerge to create a checkbox in a folder after running the merge. However, I am not sure if that would trigger the LUA rule (I have had problems in the past to get that to work: External application creates a folder value, but that doesn't trigger the rules). IF this is the case, maybe MagicMerge Could also somehow send: ++:L:trigger_rule(item_id,"IF") to trigger the rules?  
Back to top
 
« Last Edit: 11/14/08 at 14:18:36 by rb »  
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #1 - 11/16/08 at 15:09:23
 

 
Is possible to add to MM but not sure necessary to do.
 
 
If you're merging from phonebook view,
 
you can easily mark & toggle or assign all items.
 
 
 
 
but am not understanding your workflow.
 
What exactly are you trying to do that you would *want* a line added to every item merged to ?
 
 
Please describe how you are (or would like to be)  using ecco / merge in your workflow.
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #2 - 11/16/08 at 18:05:46
 
Quote from Admin on 11/16/08 at 15:09:23:


Please describe how you are (or would like to be)  using ecco / merge in your workflow.


 
I am writing a template with LUA scripts for a volunteer organization with members. Each member is an item (in the phonebook and in other contexts).  Any notes about this member are placed as subitems below the member.  Sometimes an E-mail is sent out to selected members. When this happens, I want to place a subitem-note below those members, e.g. "E-mails about xxx sent".  I already have a LUA script that does this; clicking on a button places a note below the selected members. However, I want this script to execute when clicking on merge.
 
Otherwise, we run the risk that the E-mails are sent out, and the person clicking the merge button forgets to execute the script or vice versa. Then the notes would not match what actually was done...  
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #3 - 11/17/08 at 08:24:00
 

What if the email didn't go out ?
 
What if the merged form used the wrong field for email (ie. no email to send to for most) ?
 
 
In an office would you check off sending when you printed the letter or when you actually place it in the mail ?
 
 
 
also,
 
is it best to have a subline for each email (taking up an item pointer memory for each email sent),   or would a folder work just as good, eg.
folder "Emailed to on 01.02.09"  attached to emails sent that day.
 
a person could have hundreds of folders attached to them,  showing each day an email was sent.
 
 
=or=
 
a single email sent on  field,  updated with date each additional email was sent.
 
 
 
 
ie.
 
since there is MUCH we can do,
 
if we're going to do anything,
 
we might as well figure out,
 
if there is a better/cooler/more effective way to do it.
 
 
 
Basic idea would be for a file based default tag to attach (that could be modified ?) to each item included in email/fax/print.
 
 
note that with MM,  you can easily use Word logic to send to some records and not others.    
 
 
 
ps: have you tried to email with MM ?
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #4 - 11/17/08 at 08:25:24
 
Quote from rb on 11/16/08 at 18:05:46:

I am writing a template with LUA scripts for a volunteer organization with members.
..
I already have a LUA script that does this; clicking on a button places a note below the selected members. However, I want this script to execute when clicking on merge.


 
I wish we could get yours (and everyones)   scripts and rules posted at the SRules board,    it likely would inspire a lot more slang rulers....
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #5 - 11/17/08 at 14:18:52
 
1. Many scripts are very specific to the program template and what I personally try to accomplish so it would not make sense to post those scripts. Other scripts may be modified to make them more 'generic' and could indeed be posted...
 
2. Regarding MM, I prefer to write my own scripts to make it more flexible.  Thus, I would l simply want MM to trigger my LUA rule(s) for items that were merged.
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #6 - 11/17/08 at 21:11:47
 

 
so, a slang specific feature,
 
toggle a field value.
 
 
 
something like,
 
if you file has a field "MagicMerge Check ME",  it will be toggled on merge,
 
and folder based rules will be triggered.
 
 
something like that ?
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #7 - 11/17/08 at 21:14:51
 
Quote from rb on 11/17/08 at 14:18:52:
1. Many scripts are very specific to the program template and what I personally try to accomplish so it would not make sense to post those scripts. Other scripts may be modified to make them more 'generic' and could indeed be posted...


 
 
even the most unique template can give others example/insight.
 
 
posting the entire .eco (with rules intact) is best.
 
 
The Template creation tool of the ADT should make it easy-- killing all the data but leaving the data structure and rules.
 
note: if there is sensitive data in a file, after creating template COMPRESS the file, save,  and open in alternate viewer to verify all data is gone.  Corrupt file has 'folded' data set,  so items appear multiple times in file,  but you don't see them via ecco interface.
 
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #8 - 11/17/08 at 21:34:14
 
Quote from Admin on 11/17/08 at 21:11:47:


so, a slang specific feature,

toggle a field value.



something like,

if you file has a field "MagicMerge Check ME",  it will be toggled on merge,

and folder based rules will be triggered.


something like that ?


 
Exactly!
 
However, I have never been able to get this to work. When an external application modifies a folder value, the rules are not triggered (only when I manually change the folder value in Ecco). Thus, it may be best to also send the LUA trigger command.
 
p.s. I would make a much short field/folder name though, e.g. "_MM"
Back to top
 
 
  IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #9 - 11/18/08 at 03:49:07
 
Quote from Admin on 11/17/08 at 08:24:00:


ps: have you tried to email with MM ?


 
Yes, but I have some problems/questions:
 
1. When I insert the E_mail field using the template builder, it is inserted between special symbols "«  »", i.e. "«E_Mail».
However, in the help file it is inserted between curly brackets: {E-mail}.   This doesn't work!
 
2. How do I create the hidden field. The help file says: {IF 1=2 "{E_mail}"}.
I do not understand this:
A. Curly brackets do not seem to work. What is the correct syntax?
B. How is this a hidden field?
 
 
3. I do not understand the description of how to use a word template inside the Ecco file.
A. Do you mean saving a link to a word file on the hard drive, or actually saving the word file as an object inside Ecco?
B. I selected several items in Ecco to merge, and then also selected an inserted word object, but when I clicked on Merge the word document was not selected...
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #10 - 11/18/08 at 05:47:56
 
Quote from rb on 11/18/08 at 03:49:07:

1. When I insert the E_mail field using the template builder, it is inserted between special symbols "« »", i.e. "«E_Mail».
However, in the help file it is inserted between curly brackets: {E-mail}. This doesn't work!

 
 
the special symbols can vary depending upon the view mode of Word.   Set view mode (options) to show Field CODES.
 
 
the curly brackets are special Word symbols.  You get a pair by pressing control+F9 (if memory serves).
 
 
Quote:

2. How do I create the hidden field. The help file says: {IF 1=2 "{E_mail}"}.
I do not understand this:
A. Curly brackets do not seem to work. What is the correct syntax?
B. How is this a hidden field?

 
 
use ctrl+F9 for word fields.
 
 
since 1 is never = 2, the document never prints the E_mail folder contents.    
 
But,  if you include the field at start of file, using *any* E_mail folder,  you can create a per file default folder to use for email address.
 
 
note: similar with "subject" field of document being default.
 
 
Quote:


3. I do not understand the description of how to use a word template inside the Ecco file.
A. Do you mean saving a link to a word file on the hard drive, or actually saving the word file as an object inside Ecco?
B. I selected several items in Ecco to merge, and then also selected an inserted word object, but when I clicked on Merge the word document was not selected...

 
 
A. Either one works fine.  Personally save word doc templates INSIDE the relevant ecco file so is 100% portable.  (and easy,  when need to print report,  go to 'reports' folder,  pull the desired form (ie. double click to open it in word), and click Merge...
 
B. OPEN the inserted word object,  select items in Ecco, and merge to "Active Word Document".
 
ie. you can merge ON-THE-FLY from *ANY* word document (and *any* ecco file).
 
C. if your PHONE book view (for example) contains the desired records to merge,  you can select SINGLE WORD FORM (link or actual) in ecco, and then activate merge.  The *single* selected Word template will be automatically used for merge (eg., as Active Word Document).
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #11 - 11/18/08 at 05:54:37
 
Quote from rb on 11/17/08 at 21:34:14:


However, I have never been able to get this to work. When an external application modifies a folder value, the rules are not triggered (only when I manually change the folder value in Ecco). Thus, it may be best to also send the LUA trigger command.
 
 
this should not be case.
 
Have you tested with MagicView ??
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Command Line Switches?
Reply #12 - 11/18/08 at 13:05:07
 
Are there any Command Line Switches?
Can I start MM and open the MM Merge Window for E-mails right away?
 
Now it is necessary to first start MM, next click on the icon while holding down shift-key.
 
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #13 - 11/18/08 at 22:07:38
 

 
if helpful there is a hotkey shortcut for email merge,
 
WindowsKey + Shift + W + E
 
 
 
if you're trying to activate from LUA script,
 
is possible to add external call option.
 
 
 
ps: when you try MagicView,  do your LUA scripts run on folder updates ?
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #14 - 11/19/08 at 01:53:38
 
Quote from Admin on 11/18/08 at 22:07:38:


if you're trying to activate from LUA script,
is possible to add external call option.

ps: when you try MagicView,  do your LUA scripts run on folder updates ?

 
Activating E-mail merge from LUA script would be great (better than the other way around where MM starts LUA script).
 
I haven't had a chance to try MagicView yet.
Back to top
 
 
  IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #15 - 12/10/08 at 17:35:49
 
Is there anyway to call MM from a LUA command yet?
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #16 - 12/10/08 at 18:07:50
 

what specifically do you mean by 'call' ?
 
 
to bring up the MM click to merge window,
 
or to actually input options and directly merge ?
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #17 - 12/10/08 at 19:01:45
 
I was hoping for the following:
I have a LUA script that I execute using a button in Ecco. It does some Ecco processing, then starts and opens the MM (the user may have to click on the MERGE button), after MM is complete, the LUA script continues the execution.
 
The alternative is now to manually execute script1, run MM, execute script2. If script1 or script2 are not executed, then the data will be messed up, so I would need all 3 to execute by clicking on 1 button.
 
Thus, what I need is a LUA command that opens and executes the MM.
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #18 - 12/10/08 at 20:18:23
 


 
so tool to :
 
 
1. launch the MM press button to merge screen,
 
2. wait for merge to be completed,
 
3. release back to the LUA.
 
 
would that do it ?
 
Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #19 - 12/10/08 at 20:40:23
 
Quote from Admin on 12/10/08 at 20:18:23:



so tool to :


1. launch the MM press button to merge screen,

2. wait for merge to be completed,

3. release back to the LUA.


would that do it ?


 
Note sure exactly what step one does.
There would be a command "Launch MM" in my LUA script; e.g.
 
function merge()
Do some standard EccoExt LUA processing
.
Launch MM
.
Do some more LUA processing
end
 
The Launch MM command would:
A. Activate MagicMerge for Word
B. Execute "Word Merge"
C. Click the Merge Button
 
(When done, the script would continue with "Do some more LUA processing"
Back to top
 
 
  IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #20 - 12/11/08 at 13:42:12
 
Furthermore, and this would be very useful:
 
I can now only insert fields that are associated with the items to be Merged.
However, I would also like to insert values from other items (that are not being merged).
 
Using a LUA script, I could get these values and then pass them to MM in the LUA command that starts MM:
 
Launch MM(arg1, arg2, arg3...)
 
The arg1, arg2, arg3... would then be fields that could be inserted into the document.
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #21 - 12/11/08 at 14:15:24
 
Quote from rb on 12/11/08 at 13:42:12:
Furthermore, and this would be very useful:

I can now only insert fields that are associated with the items to be Merged.
However, I would also like to insert values from other items (that are not being merged).

Using a LUA script, I could get these values and then pass them to MM in the LUA command that starts MM:

Launch MM(arg1, arg2, arg3...)

The arg1, arg2, arg3... would then be fields that could be inserted into the document.

 
 
am not tracking you here.
 
 
you can insert values from items that don't "print".    
 
in Word you do this via conditional  (see MM instructions for basic overview).
 
you still need to merge the items,  but for example,
 
if the merged item has value X,  use that for some purpose but don't do normal merge with item,  etc.
 
 
MM allows you also to use the first item in phonebook as 'header' on top of normal merge.
 
 
 
but likely am just not tracking...
 
MM(arg1,arg2... etc.)   what is arg ?   a fixed var to be passed to the word merge ?
 
if so,
 
why not just make the FIRST item in your merge to contain these folders,
 
and have word take the data from there ?
 
 
hope is clear enough to be helpful.
 
 
Edited:

 
adding this example:
 
 
Let's say you have a phone entry with key data in various folders.
 
load that into phonebook.
 
 
then go to another notepad with the actual items to merge (could be filtered phonebook items even,  or other item list).
 
 
use the MM "Header Record" option,   and phonebook item will be added as 'header'  to the other items selected for your merge.
 
 
within the word doc,
 
use the first item to fill in your 'args'.
 
 
____________________
 
alternative with LUA,
 
 
have LUA simple add the additional info into folders of FIRST item in list.
 
eg.,  list of 100 names,
 
at name 1,  add in folder A val A, folder B val B, etc.  then use A, B, etc. as your 'args'.
 
normal merge info might be "business, address, etc."
 
 
 
 
 

Back to top
 
 

The Administrator.
WWW   IP Logged
rb
Senior Member
****


I Love Ecco!

Posts: 88
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #22 - 12/11/08 at 16:19:26
 
I am not sure if that would work. I tried the option, but must not have understood because the merged docs looked the same with or w/o the option enabled.
 
In any case, here is a simple example of what I want.
 
I have a separate itemX with folders F1(number) & F2(Text)
 
I have 2 items to merge with Folder F3 (text).
Note that the F1 Value is changing during the execution of the merge (by a LUA script)
 
Template
{F1}
{F2} {F3}
 
Results:
100
"Some Text" "Company1"
===== Section Break=====
105
"Some Text" "Company2"
 
A workaround is to transfer the Folder values from F1 & F2 to the the items to be merged (using a LUA script), and then execute the MM using these moved fields.  Simpler, but would add a lot of duplicate data in the file.  
 
In any case, would be very useful to be able to start MM in that LUA script (as originally suggested in this thread).
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: MagicMerge trigger LUA rule or vice versa?
Reply #23 - 12/11/08 at 22:16:11
 
Quote from rb on 12/11/08 at 16:19:26:
I am not sure if that would work. I tried the option, but must not have understood because the merged docs looked the same with or w/o the option enabled.


I have a separate itemX with folders F1(number) & F2(Text)

I have 2 items to merge with Folder F3 (text).

Note that the F1 Value is changing during the execution of the merge (by a LUA script)

Template
{F1}
{F2} {F3}

Results:
100
"Some Text" "Company1"
===== Section Break=====
105
"Some Text" "Company2"

A workaround is to transfer the Folder values from F1 & F2 to the the items to be merged (using a LUA script), and then execute the MM using these moved fields. Simpler, but would add a lot of duplicate data in the file.

In any case, would be very useful to be able to start MM in that LUA script (as originally suggested in this thread).

 
 
can do.
 
tricky in that must pause for merge to finish,  then release.
 
 
 
in your Word template you have to transfer the live occurence of the F1 and F2  to a word var (bookmark) that you can then use,
 
otherwise the header data is lost with merge of 2nd record.
 
see example .doc Wink
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Pages: 1 
Send Topic Print