Using KM I want to grab details from a webpage and then save the details as KM variables, time is of the essence as a result is it possible to asynchronies savings the details as KM variables? https://bittrex.com/api/v1.1/public/getmarketsummaries
To speed things up can this be done without loading safari by using some sort of ping in the background?
I’m not completely sure if I understood correctly what you are looking for.
This will export each of the 6 keys as indicated in your post #1 to individual variables. Afterwards your variable inventory will be well populated like this:
Yes. But you can do it in any language, including KM itself. However, since your data is already a JSON string the built-in JSON parser of JavaScript is very convenient.
With the input from your source URL the macro is creating about 1600 variables. So, I think it’s not exaggerated to say that you are misusing KM as a database
Considering your follow-up post where you are trying to query the data, wouldn’t it be better to export the data to a CSV text file which can be read by Excel for example? Or to a proper database which you can properly query for whatever you need?
It is inadvisible to create a lot of KM global variables, unless you really need them. And it is unlikely that you need 100's of variables. As Tom says, if you find that you think you need 100s of variables, for just one macro (or a set of related macros), then you may want to reconsider your design.
If you need to store data for 100s of variables, then some type of database is indicated, or at least one file with all the data in something like a plist of JSON format.
If anyone has questions about this, feel free to ask.
Good point. Thanks for pointing this out. I had forgot where the source came from.
BTW, if it were me, I'd put this data in a SQLite database. @ShaneStanley has recently released SQLite Lib, an AppleScript Script Library that makes accessing a SQLite database very easy and fast.
Using KM and the JSON data how can I match the coins trading in more than one market and do an action for each matching MarketName? e.g. ‘1ST’ exists in ‘BTC-1ST’ match to see if it also exists in ‘ETH-1ST’ or ‘USDT-1ST’.
How can I do a match in KM to retrieve all coins (1ST and more trading in more than one exchange (BTC, ETH or USDT).
Preferably I would like the MarketName to be returned to do an action for each.
I’m afraid I can’t help you with the JSON data, but in case you missed it, I did show you in another thread how to assemble a list of variables with matching suffixes that you can probably use or modify to include further For Each actions for matching sets: How to compare 2 string variables? (if nameA == nameB)