There is some useful stuff on fmepedia under FME Usage FAQs - FME
Internals.

One link is...
http://www.fmepedia.com/index.php/Support_-_Internals_FAQ#What_is_the_difference_between_the_functions_.40TCL.28.29_and_.40Tcl2.28.29.3F

and another is...
http://www.fmepedia.com/index.php/Pre_and_Post_Processing_with_TCL_FAQ

Hope these are useful,

Mark

Mark Ireland, Product Support Engineer
Safe Software Inc. Surrey, BC, CANADA
[EMAIL PROTECTED] http://www.safe.com
Solutions for Spatial Data Translation, Distribution and Access


--- In [email protected], "peter laulund" <[EMAIL PROTECTED]> wrote:
>
> Hi again
> 
> one more thing Tcl2/TCL  and FME_BEGIN/END_TCL can not be mixed as
they use 
> a different interpereter - ie. you can not see variables / code in both 
> interperters, the a seperated,
> 
> so in order to place variables into the begin/end you have to assing
the 
> variable in connection to the  FME_BEGIN/END_TCL directive. - note
you cna 
> have more than one
> 
> One trick here is to use the MAPPING_FILE_ID, put some values into
it using 
> macroes, and then extract the values from the variable FME_MappingFileId
> 
> one off the tricky parts off working with tcl and fme - apart from
all the 
> {[(;  - is that tcl is inwoked on meany levels - you can use it as
> - a attribute function - Tcl2
> - feature function   - Tcl2
> - it can dynamically write your mapping files - INCLUDE [ puts
> - as pre/post processing - BEGIN/END tcl script
> - in batch mode - fme.exe script.tcl
> - as a standalone project with fmeobject
> 
> and you can mix it all i a mapping file / project
> 
> Peter
> 
> 
> >From: "RichardW" <[EMAIL PROTECTED]>
> >Reply-To: [email protected]
> >To: [email protected]
> >Subject: [fme] Re: Macros, Parameters & FME_END_TCL
> >Date: Wed, 21 Dec 2005 15:47:06 -0000
> >
> >Thanks Peter,
> >
> >I have moved forward and can now pass a parameter to my called tcl
> >script.  However I am still unable to create my own global.  Here is
> >an extract from my header:
> >
> >
> >TCL puts {ZZZZZZZZZZZZZZZZZZZZZZ $(FME_MF_DIR)}
> >TCL2 set RwAdmin RichardW
> >TCL puts {XXXXXXXXXXXXXXXXXXXXXX $RwAdmin}
> ># Call script to log status in Oracle table
> >FME_END_TCL source {$(FME_MF_DIR)Test_FME_END.tcl} ; set  myVar
> >$(FME_MF_DIR)
> >
> >
> >and from my tcl script:
> >
> >puts {Printed from called tcl program $MyVar}
> >
> >
> >The output extract is:
> >
> >Opened native MapInfo file `C:\MapTest\MyAggregateTest.tab'
> >ZZZZZZZZZZZZZZZZZZZZZZ C:\MapTest/
> >XXXXXXXXXXXXXXXXXXXXXX $RwAdmin
> >
> >Translation was SUCCESSFUL (4 feature(s)/43 coordinate(s) output)
> >FME Session Duration: 1.5 seconds.
> >Printed from called tcl program $MyVar
> >
> >
> >You can see that the pre-defined macros expand ok but the globals
> >RwAdmin and MyVar do not work.  I think that it must be either the
> >way I am defineing them or the way I am calling them that is wrong. I
> >tried following your example.  Can you see what I am doing wrong.
> >
> >Richard W
> >
> >
> >
> >
> >
> >
> >
> >--- In [email protected], "peter laulund" <[EMAIL PROTECTED]>
> >wrote:
> > >
> > > Hi
> > >
> > > wheter your code is in the global namespace or in a proc you can
> >use one off
> > > these options
> > >
> > > FME_END_TCL source {$(FME_MF_DIR)Test_FME_END.tcl} ; myProg
> >$(macroName)
> > >
> > > where you give the macro as a parameter to the proc starting the
> >script
> > >
> > > or you can just place the value in a global variable
> > >
> > > FME_END_TCL source {$(FME_MF_DIR)Test_FME_END.tcl} ; set  myVar
> >$(macroName)
> > >
> > > you can use this syntax when starting any kind of tcl (FME_END_,
> >INCLUDE [
> > > or Tcl2/TCL) as an exampel from a project i am working on right now
> > >
> > >
> > > Tcl2 set gsPath2App
> >$(FME_MF_DIR_UNIX)/
> > > ; \
> > >      set gsPath2Data [regsub -all -- {\\} {$(DestDataset)/
> >$(DestFormat)}
> > > {/}] ; \
> > >      set dbf $gsPath2App/tcl/def/
> >$(Dataset)/felter.dbf
> > > ; \
> > >      catch { file mkdir
> >$gsPath2Data }
> > > ; \
> > >      source
> >$gsPath2App/TCL/ATTRIBUT.TCL
> > > ; \
> > >      source $gsPath2App/TCL/$(DestFormat)
> >_OUT.TCL
> > > ; \
> > >      source
> >$gsPath2App/TCL/LIB/LANUTIL.TCL
> > > ; \
> > >      main $(DestFormat)
> > >
> > > Note: you have to sepperate the command with a ; and also note the
> >use of
> > > FME_MF_DIR_UNIX/ this gives a parth with / rather than \ allowing
> >us to get
> > > rid of the {} around the parth :-}
> > >
> > > Peter Laulund
> > >
> > >
> > > >From: "RichardW" <[EMAIL PROTECTED]>
> > > >Reply-To: [email protected]
> > > >To: [email protected]
> > > >Subject: [fme] Macros,  Parameters & FME_END_TCL
> > > >Date: Tue, 20 Dec 2005 15:05:56 -0000
> > > >
> > > >Hi group,
> > > >
> > > >I am having trouble passing a parameter to a tcl script invoked by
> > > >FME_END_TCL.
> > > >
> > > >I have used Tools, Edit Header to include the following:
> > > >
> > > ># =================================================================
> > > ># Call script to log status in Oracle table
> > > >FME_END_TCL source {$(FME_MF_DIR)Test_FME_END.tcl}
> > > ># =================================================================
> > > >
> > > >
> > > >The Test_FME_END.tcl script logs the translation status in an
> >oracle
> > > >table.  This works fine.
> > > >
> > > >Now I want to generalise the procedure so that the same tcl script
> >is
> > > >used for each transform.  A parameter(s), eg administrator email,
> >set
> > > >in the header will pass through to the tcl script which will be
> > > >logged in the database and used to trigger an email alert to the
> > > >appropriate administrator.
> > > >
> > > >I cannot figure out how to set a parameter in the header and pass
> >it
> > > >to my tcl script.
> > > >
> > > >Can anyone help with this
> > > >
> > > >Thanks
> > > >Richard
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >Get the maximum benefit from your FME, FME Objects, or
> >SpatialDirect via
> > > >our Professional Services team.  Visit www.safe.com/services for
> >details.
> > > >Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > > _________________________________________________________________
> > > Del din verden med MSN Spaces http://spaces.msn.com
> > >
> >
> >
> >
> >
> >
> >
> >
> >
> >Get the maximum benefit from your FME, FME Objects, or
SpatialDirect via 
> >our Professional Services team.  Visit www.safe.com/services for
details.
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> 
> _________________________________________________________________
> Del din verden med MSN Spaces http://spaces.msn.com
>






Get the maximum benefit from your FME, FME Objects, or SpatialDirect via our 
Professional Services team.  Visit www.safe.com/services for details. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/fme/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to