AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() To make this list into a single piece of text with one city per line, use the list that contains city names only set the text item delimiters to linefeed then coerce the list to text. This returns a list of all the city names (or a list of lists of IP address-city name pairs if you elect to use the line I commented out as an alternative). ![]() Set URLQueryString to "?access_key=" & the APIKey & "&fields=city" After the repeat loop is complete, your final command would simply be a reference to that list so as to have AppleScript evaluate its contents and return the result: set APIKey to "" ![]() You can do this by first declaring a variable as an empty list, into which you would add an item of data in each iteration of your repeat loop. Custom scripting is usually required to manipulate text with AppleScript. Overall, JavaScript has a much wider-range of built-in language-level text manipulation functions. The problem is that I don't know how to control (exec line by line, debug, etc.) AppleScript execution, if it's possible at all. AppleScript and JavaScript both possess some basic text manipulation functions and properties that allow you to concatenate text, get the length of a string, and more. For this, own scripting language can be left untouched, but mapping to AppleScript can be added. So for a more comprehensive solution, you can edit your script slightly so that the last command will be one that returns what you actually want. And also to engane AppleScript as much as possible. ![]() The final command in your script will be set cityName to city of json, and so the result of your script will be the value of cityName after it has been set to the value from the JSON record that pertains specifically to the last IP address in your list, i.e. It will print a live result from each AppleScript command executed during the run of a script, whereas the Results pane only returns the overall result of the script's execution (which equates to the result of only the final command). The immediate solution would be to use the Replies pane rather than the Results pane in Script Editor. ![]()
0 Comments
Read More
Leave a Reply. |