
ade234
Members-
Posts
9 -
Joined
-
Last visited
Everything posted by ade234
-
HI I have an apple script that works natively in Applescript but is failing with errors when called within a script "Perform Applescript". It seems to be something to do with the way FM_TXT is being read. The error is Can't get 40 thru 64 of "47". -1728 Here is the Applescript that works as an applescript. set FM_Output to "filemac:/Applications:MyTools:Database_Conform:Applescript:temp:000.xml" as alias set FM to (open for access FM_Output) set FM_TXT to (read FM) as Unicode text set AppleScript's text item delimiters to (ASCII character 10) set XMLNameLength to (offset of "16680" in (paragraph 1 of FM_TXT)) set XMLName to (text 40 thru XMLNameLength of FM_TXT) as string display dialog "Reel Name is " & XMLName giving up after 5 Here is the PerformApplescript : set the_file to ":Applications:MyTools:Database_Conform:Applescript:scripts:test.scpt" as alias try run script (the_file) on error err number error_number display dialog err & " " & error_number end try Would it matter within Filemaker that the 000.xml file is not correctly formatted at this point as a standard xml. Applescript itself does not seem to mind that it is not. Thanks
-
HI, I have an applescript that selects the name and path of an XML file that id like to then parse into filemaker. I have tried using "Set Variable" to do this but cannot make the link between the applescript and $VariableName. It is currently not working and is hard to find any examples on the web. Any help is much appreciated. It would look something like this. (which is SO NOT working) Filemaker Script Perform Applescript: global file2open set file2open to (choose file) set file2openName to POSIX path of file2open set $theFile to file2openName Set Variable: [$FileToImport; Value: "filemac:/"& "$theFile"] Import Records: [No dialog; $theFile; myxslt; Add; Mac_Roman]
-
XML import - multiple children types to FM Rows ?
ade234 replied to ade234's topic in Importing & Exporting
After a bit more noodling i have come up with this that seems to work. Im not sure if it can me made to be more robust, let me know if it can. It is now adding tracks, clipitems and transitionitems in order of the XML. YAY <xsl:for-each select="//clipitem | //transitionitem | //track"> in <?xml version='1.0' encoding='UTF-8' ?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match='/'> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="11/13/2002" NAME="Filemaker Pro" VERSION="6.0V4"/> <DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="combotest.fp7" RECORDS="" TIMEFORMAT="h:mm:ss a"/> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="track" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="name" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="in" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="comment" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Dissolve" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="DissolveDuration" TYPE="NUMBER"/> </METADATA> <RESULTSET FOUND=""> <xsl:for-each select="//clipitem | //transitionitem | //track"> <ROW MODID="" RECORDID=""> <COL><DATA><xsl:value-of select="./track /></DATA></COL> <COL><DATA><xsl:value-of select="./name" /></DATA></COL> <COL><DATA><xsl:value-of select="./in" /></DATA></COL> <COL><DATA><xsl:value-of select="./comment/comment1" /></DATA></COL> <COL><DATA><xsl:value-of select="./transitionitem/name" /></DATA></COL> <COL><DATA><xsl:value-of select="./transitionitem/duration" /></DATA></COL> </ROW> </xsl:for-each> </RESULTSET></FMPXMLRESULT> </xsl:template> </xsl:stylesheet> -
XML import - multiple children types to FM Rows ?
ade234 replied to ade234's topic in Importing & Exporting
Thanks comment, Yes I do want to create a new record for each item, whether track, clipitem or transitionitem. My problem is getting the right nomenclature for the xsl template to be able to do this. Currently it is only populating the records with the clipitem values. <xsl:for-each select="./xmeml/sequence/media/video/track/clipitem"> How do I adjust the template to encapsulate clipitems and transitionitems and tracks? I have tried the below but it just leaves me with one mysterious event in the result DB. <xsl:for-each select="./xmeml/sequence/media/video/track"> Also the track would not have any DB fields associated with it . That said i do need to know where and at what point the track events occur in relation to the other events. src XML again.... <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xmeml> <xmeml version="5"> <sequence> <media> <video> <track> <clipitem> <name>1</name> <in>123</in> </clipitem> <clipitem> <name>2</name> <in>234</in> <comment> <comment1>nnn</comment1> </comment> </clipitem> </track> <track> <clipitem> <name>3</name> <in>345</in> </clipitem> <clipitem> <name>4</name> <in>456</in> </clipitem> <transitionitem> <name>dissolve</name> <duration>12</duration> </transitionitem> <clipitem> <name>5</name> <in>567</in> </clipitem> </track> </video> </media> </sequence> </xmeml> Thanks, Ade -
XML import - multiple children types to FM Rows ?
ade234 replied to ade234's topic in Importing & Exporting
Sorry, It is meant to represent a single filemaker table layout of rows and columns. Is there a way to better represent this? updated references Source XML <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xmeml> <xmeml version="5"> <sequence> <media> <video> <track> <clipitem> <name>1<name> <in>123</in> </clipitem> <clipitem> <name>2<name> <in>234</in> <comment> <comment1>nnn</comment1> </comment> </clipitem> </track> <track> <clipitem> <name>3<name> <in>345</in> </clipitem> <clipitem> <name>4<name> <in>456</in> </clipitem> <transitionitem> <name>dissolve</name> <duration>12</duration> </transitionitem> <clipitem> <name>5<name> <in>567</in> </clipitem> </track> </video> </media> </sequence> </xmeml> and XSL <?xml version='1.0' encoding='UTF-8' ?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match='/'> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="11/13/2002" NAME="Filemaker Pro" VERSION="6.0V4"/> <DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="combotest.fp7" RECORDS="" TIMEFORMAT="h:mm:ss a"/> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="track" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="name" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="in" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="comment" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Dissolve" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="DissolveDuration" TYPE="NUMBER"/> </METADATA> <RESULTSET FOUND=""> <xsl:for-each select="./xmeml/sequence/media/video/track/clipitem"> <ROW MODID="" RECORDID=""> <COL><DATA><xsl:value-of select="./preceding-sibling::track /></DATA></COL> <COL><DATA><xsl:value-of select="./name" /></DATA></COL> <COL><DATA><xsl:value-of select="./in" /></DATA></COL> <COL><DATA><xsl:value-of select="./comment/comment1" /></DATA></COL> <COL><DATA><xsl:value-of select="./transitionitem/name" /></DATA></COL> <COL><DATA><xsl:value-of select="./transitionitem/duration" /></DATA></COL> </ROW> </xsl:for-each> </RESULTSET></FMPXMLRESULT> </xsl:template> </xsl:stylesheet> Thanks, Ade -
Hi, I have a xml that looks a little like this: <sequence> <media> <video> <track> <clipitem> <name>1<name> <in>123</in> </clipitem> <clipitem> <name>2<name> <in>234</in> <comment> <comment1>nnn</comment1> </comment> </clipitem> </track> <track> <clipitem> <name>3<name> <in>345</in> </clipitem> <clipitem> <name>4<name> <in>456</in> </clipitem> <transitionitem> <name>dissolve</name> <duration>12</duration> </transitionitem> <clipitem> <name>5<name> <in>567</in> </clipitem> </track> </video> </media> </sequence> I am attempting to create a database that creates a new row for the following items and looks like the below: COLUMNS: type / name / in / comment / DisolveDuration / track clipitem / 1 / 123 clipitem / 2 / 234 / nnn track clipitem / 3 / 345 clipitem / 4 / 456 transitionitem / dissolve / / / 12 clipitem / 5 / 567 I am using the below stylesheet but can't find a way to get all clipitems and tracks and transition items to come up in order in rows. The current stylesheet adds all clipitems only. <?xml version='1.0' encoding='UTF-8' ?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match='/'> <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="11/13/2002" NAME="Filemaker Pro" VERSION="6.0V4"/> <DATABASE DATEFORMAT="d/M/yyyy" LAYOUT="" NAME="combotest.fp7" RECORDS="" TIMEFORMAT="h:mm:ss a"/> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="track" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="name" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="in" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="comment" TYPE="NUMBER"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Dissolve" TYPE="TEXT"/> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="DissolveDuration" TYPE="NUMBER"/> </METADATA> <RESULTSET FOUND=""> <xsl:for-each select="./xmeml/sequence/media/video/track/clipitem"> <ROW MODID="" RECORDID=""> <COL><DATA><xsl:value-of select="./preceding-sibling::track /></DATA></COL> <COL><DATA><xsl:value-of select="./name" /></DATA></COL> <COL><DATA><xsl:value-of select="./in" /></DATA></COL> <COL><DATA><xsl:value-of select="./comment/comment1" /></DATA></COL> <COL><DATA><xsl:value-of select="./transitionitem/effect/name" /></DATA></COL> <COL><DATA><xsl:value-of select="./transitionitem/duration" /></DATA></COL> </ROW> </xsl:for-each> </RESULTSET></FMPXMLRESULT> </xsl:template> </xsl:stylesheet> Any assistance would be most appreciated, Ade