Welcome, Guest. Please Login or Register.
eccoMAGIC Forums
07/21/24 at 20:26:15
News: The Yahoo New Yahoo! Ecco_Pro forum was ended by Yahoo's end of board support... New group is at groups.io
Home Help Search Login Register


Pages: 1
Send Topic Print
  Rating
Rate:
Rating:
Rating: 10.00
Votes: 1

5
4
3
2
1










1

5
4
3
2
1


1


2


3


4


5


6


7


8


9


10

Dictionary Lookup ;) (Popularity: 11883 )
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Dictionary Lookup ;)
11/16/07 at 08:21:03
 

 
 
 
 
In response to a    *very* helpful file posted by Albert,
 
Quote:
--- In ecco_pro@yahoogroups.com, ecco_pro@yahoogroups.com wrote:
>
>
> Hello,
>
> This email message is a notification to let you know that
> a file has been uploaded to the Files area of the ecco_pro
> group.
>
>   File        : /Examples & Templates for Slang Rule/books.eco
>   Uploaded by : albertschepers <as@...>
>   Description : A File to catalogue documents and auto launch them
>

 
 
note:  there is a LOT going on in that file, and the RULE explanations there are super helpful.  THANKS!
 
 
 
Might want to experiment with [untested & might need tweek for syntax],  a different approach for list selection.   Ie.  instead of nested iff's  (which works),  there is a (?) simpler way to same result:
 
 
imatch("pdf=Adobe,xls=Spread,wpd=WordPer,", gfv("File Name") + "=(.+?),")
 
 
the first string is our choice list.  It can be as long as want,  will work with hundreds of choices.   MAKE SURE TO END IT WITH A ","! *or*, a "blank"  such as "wpd=WordPer,*end*".
 
the gfv(...) just gets the value you want,  THIS COULD BE AN IMATCH ITSELF... ie. to take what is matched OUT of a larger context.
 
the + combines it with what follows,
 
=  looks for an equals sign,
 
(.+?) matches up to the next ","
 
 
 
[apologize for not having time to test,  this may need correction, etc.,  please test/correct as necessary.   Hopefully the idea is helpful.  ]
 
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
albertschepers
Contributing  Member
***


I Love Ecco!

Posts: 11
Gender: male
Show the link to this post Re: Dictionary Lookup ;)
Reply #1 - 11/21/07 at 12:26:51
 
I have tested the proposed alternate but it does not seem to work.  Sad Tried variations on the theme but, perhaps my lack of knowledge in regex, I cannot seem to get it to work though I like the concept as it simplifies the programming.  Probably faster as well.
Back to top
 
 

Albert Schepers
Email WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Dictionary Lookup ;)
Reply #2 - 11/21/07 at 17:01:14
 
Quote from albertschepers on 11/21/07 at 12:26:51:
I have tested the proposed alternate but it does not seem to work.

 
Code:
imatch("pdf=Adobe,xls=Spread,wpd=WordPer,", gfv("File Name") + "=(.+?),") 
 


 
works just as is...   needs only a Folder called "File Name" that contains either pdf, xls, or wpd as the text.
 
 
if you want to make it based on *actual* file names,  just change the "gfv" function to another imatch:
 
 
imatch([File Name], "\.\w\w\w\s*$")
 
 
or to pull file name extension out of longer text,
 
imatch([folderName],"\.(wpd|pdf|xls|doc|etc)\b)")  <-- note need to make the \b  a  \B for bug in current extension built.
 
 
 
note for index that is numeric use:
 
Code:
imatch("pdf=Adobe,xls=Spread,wpd=WordPer,", "" + gfv("File Name") + "=(.+?),") 
 


 
and to use result as numeric:
 
Code:
0 + imatch("pdf=1,xls=2,wpd=3,", gfv("File Name") + "=(.+?),") 
 


 
 
 
Back to top
 
« Last Edit: 06/06/10 at 19:51:08 by Admin »  

The Administrator.
WWW   IP Logged
albertschepers
Contributing  Member
***


I Love Ecco!

Posts: 11
Gender: male
Show the link to this post Re: Dictionary Lookup ;)
Reply #3 - 12/28/07 at 10:08:44
 
Got back to testing ths again and I still have poblems.  I am able now to interpret the expression evaluator so perhaps the error mesage that it gives will be of some use.
 
First I tried the expression as written:
 
imatch("pdf=Adobe,xls=Spread,wpd=WordPer,", gfv("File Name") + "=(.+?),")
 
 
The error I get is:
 
attempt to call a global 'gfv' (a nil value) ( this is bogus as I just realized I was using the LUA Script section.  I get no results when I run properly)
 
 
I then tried:
 
imatch([File Name], "\.\w\w\w\s*$")
 
 
this worked
 
 
so I tried:
 
imatch(gfv("File Name"), "\.\w\w\w\s*$")
 
 
and this worked.
 
 
Albert
Back to top
 
« Last Edit: 12/28/07 at 13:26:13 by albertschepers »  

Albert Schepers
Email WWW   IP Logged
albertschepers
Contributing  Member
***


I Love Ecco!

Posts: 11
Gender: male
Show the link to this post Re: Dictionary Lookup ;)
Reply #4 - 12/28/07 at 13:39:35
 
Okay, I have tried again and am getting some results, this time I am using the proper pat of the evaluator not like the last message.  I used:
 
imatch("pdf=Adobe,xls=Spread,wpd=WordPer,*end*", imatch([File Name], "\w\w\w\s*$"))
 
in the evaluator and in the folder "File Name" I put 'test.pdf' (I did change the last three characters to wpd and xls as well to see what would happen).  The result was
 
pdf  (only the last three characters, It was not replaced with Adobe or Spread or Wordper either for the other tests)
 
 
So I am closer but still no banana as they say.
 
 
Albert
Back to top
 
 

Albert Schepers
Email WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Dictionary Lookup ;)
Reply #5 - 12/29/07 at 12:00:56
 
Quote from albertschepers on 12/28/07 at 13:39:35:
Okay, I have tried again and am getting some results, this time I am using the proper pat of the evaluator not like the last message.  I used:

imatch("pdf=Adobe,xls=Spread,wpd=WordPer,*end*", imatch([File Name], "\w\w\w\s*$"))

in the evaluator and in the folder "File Name" I put 'test.pdf' (I did change the last three characters to wpd and xls as well to see what would happen).  The result was

pdf  (only the last three characters, It was not replaced with Adobe or Spread or Wordper either for the other tests)


So I am closer but still no banana as they say.


Albert

 
 
 
try your second imatch() with Code:
+ "=(.+?),") 


 
 
 
in other words,  your right on taking the last 3 characters (also works by "\w{3}\s*$")... but you forgot to add the code to trap the equivelance..   which can also be "=([^,]+)"
 
 
 
 
hope helps!
Back to top
 
 

The Administrator.
WWW   IP Logged
albertschepers
Contributing  Member
***


I Love Ecco!

Posts: 11
Gender: male
Show the link to this post Re: Dictionary Lookup ;)
Reply #6 - 12/31/07 at 10:24:07
 
That did the trick, I needed to 'extract' the equivalence side of the relations.  The final rule is
 
++:FI!+-:imatch("pdf=Adobe,
xls=Spread Sheet,
doc=Word,
htm=HTML,
wpd=WordPerfect,
php=Program,
com=HTML,
ppt=Presentation,",
 imatch([File Name], "\w{3}\s*$")+"=(.+?),"):
[Location]="Web" or [Location]="Server"
 
note that I put each line separate as it reads easier.
 
 
One last question; is it possible to put a wild card on the right side so that anything that does not match would have a default name for instance
 
???=None
 
where ??? would be any characteres that are not previously matched?
 
I will post this to the Wiki for reference as it now works!
 
 
Albert
Back to top
 
 

Albert Schepers
Email WWW   IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Dictionary Lookup ;)
Reply #7 - 01/01/08 at 12:43:27
 

"(?:" + imatchxxx() + "|*default*")+"=(.+?),"
 
might do the trick  (need *default*=xxx,  at *END* of your list)
 
 
untestested  Wink
 
 
hope it makes sense... (if not let me know)
Back to top
 
 

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