Page 3 of 3
Re: Getting the users country
Posted: Thu Aug 10, 2023 4:12 pm
by richmond62
Well: there's a thought:
https://lessons.livecode.com/m/2592/l/126625-zip-tool
I wonder if THAT will 'unfold' an .ods file?
Re: Getting the users country
Posted: Thu Aug 10, 2023 4:18 pm
by Klaus
If the ODS file is in fact a ZIP archive in disguise, that will do the trick!
Re: Getting the users country
Posted: Thu Aug 10, 2023 4:36 pm
by richmond62
It does work: I am halfway through running up a stack to open the 'content.xml' file inwith an ODS thing; but guests are just arriving for supper, so, what with 'polite' conversation & alcohol intake will probably not complete the thing until tomorrow.
Re: Getting the users country
Posted: Fri Aug 11, 2023 11:15 am
by richmond62
-
Humph!
Well, so far, so good: Opens an ODS file and extracts its contents where you tell it to.
BUT not yet capable of loading the 'content.xml' file into the field yet.
Bits 'stolen' from all over the place.

Re: Getting the users country
Posted: Fri Aug 11, 2023 1:46 pm
by richmond62
Of course the next question is how to get this:
-

- SShot 2023-08-11 at 15.43.34.png (3.06 KiB) Viewed 20183 times
-
rather than this
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:css3t="
http://www.w3.org/TR/css3-text/" xmlns:grddl="
http://www.w3.org/2003/g/data-view#" xmlns:xhtml="
http://www.w3.org/1999/xhtml" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xforms="
http://www.w3.org/2002/xforms" xmlns:dom="
http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="
http://www.w3.org/1998/Math/MathML" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental

xmlns:loext:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns

1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:rpt="
http://openoffice.org/2005/report" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:tableooo="
http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:dc="
http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:oooc="
http://openoffice.org/2004/calc" xmlns:xlink="
http://www.w3.org/1999/xlink" xmlns:drawooo="
http://openoffice.org/2010/draw" xmlns:ooow="
http://openoffice.org/2004/writer" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="
http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns

1.0" office:version="1.3"><office:scripts/><office:font-face-decls><style:font-face style:name="Arial Unicode MS" svg:font-family="'Arial Unicode MS'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="PingFang SC" svg:font-family="'PingFang SC'" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="co1" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="0.889in"/></style:style><style:style style:name="ro1" style:family="table-row"><style:table-row-properties style:row-height="0.178in" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ta1" style:family="table" style:master-page-name="Default"><style:table-properties table:display="true" style:writing-mode="lr-tb"/></style:style></office:automatic-styles><office:body><office:spreadsheet><table:calculation-settings table:automatic-find-labels="false" table:use-regular-expressions="false" table:use-wildcards="true"/><table:table table:name="Sheet1" table:style-name="ta1"><table:table-column table:style-name="co1" table:number-columns-repeated="2" table:default-cell-style-name="Default"/><table:table-row table:style-name="ro1"><table:table-cell office:value-type="float" office:value="5" calcext:value-type="float"><text:p>5</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="88" calcext:value-type="float"><text:p>88</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="float" office:value="97" calcext:value-type="float"><text:p>97</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>cheese</text:p></table:table-cell></table:table-row></table:table><table:named-expressions/></office:spreadsheet></office:body></office:document-content>
Re: Getting the users country
Posted: Fri Aug 11, 2023 3:21 pm
by stam
Hi Richmond,
I wasn't suggesting you import the actual spreadsheet file - that would be unusual and difficult.
I was suggesting that if you export TSV from the spreadsheet (or CSV), which is the common way this would be dealt with, that you would have difficulty importing that into a table in LC because of the extra returns within the fields... A problem that JSON would avoid...
Re: Getting the users country
Posted: Fri Aug 11, 2023 3:21 pm
by richmond62
-
Well . . .
The final nut to crack is some sort of delimitation between the cell items.
Re: Getting the users country
Posted: Mon Aug 14, 2023 4:13 pm
by andyh1234
Code: Select all
put JSONToArray(URL ("https://ipleak.net/json/")) into xArray
put xArray["country_code"] into fld "ff"
Works fine in the desktop IDE but not is the iOS simulator.
I have broken it down and the getting of the URL works fine, it is the JSONToArray that does not seem to work.
Am I missing something, do I need to add an external to get it to work in the mobile environment.
Re: Getting the users country
Posted: Tue Aug 15, 2023 12:34 pm
by stam
You need the
mergJSON external - it's cross platform including iOS, and anything you build with this will need this external.
Hopefully this will also run in the simulator, do let us know...
S.
PS: Alternatively you could use FerrusLogic's excellent
PhotonJSON library (livecode stack rather than external but still needs to be included). This also includes a JSONtoArray function - see more details on their GitHub page
https://github.com/Ferruslogic/PhotonJSON
Re: Getting the users country
Posted: Wed Aug 23, 2023 5:42 pm
by andyh1234
Thanks, I don't think I have that external, I am sure at one point in the past I had it but cannot find a download link for it now.
Re: Getting the users country
Posted: Wed Aug 23, 2023 11:27 pm
by stam
andyh1234 wrote: Wed Aug 23, 2023 5:42 pm
Thanks, I don't think I have that external, I am sure at one point in the past I had it but cannot find a download link for it now.
I think it's included, you just need to reference it by selecting the inclusions manually?
Or if not just use PhotonJSON - it's a stack library so you'd need to include that stack.