• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Count word's occurences
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Count word's occurences


  • Subject: Re: Count word's occurences
  • From: Guido Tangorra <email@hidden>
  • Date: Tue, 09 Sep 2014 15:22:28 +0200

Hi Nigel,
I'm creating a text document from scratch:

tell application "TextWrangler"
    activate
    set myDocument to make new text document with properties {name:theDocName}
end tell


Then I'm adding lines to the document based on a JSON response

on idle

tell application "JSON Helper" to set myFruit to fetch JSON from mySource

tell application "TextWrangler" to make new line at end of text of document theDocName with data (myFruit & return)

return 0.5

end idle

In the idle handler I want to add a fruit counter so the count is made at runtime (and attached to the JSON response) and not after saving the document.



2014-09-09 14:04 GMT+02:00 Nigel Garvey <email@hidden>:
Guido Tangorra wrote on Tue, 09 Sep 2014 12:41:32 +0200:

>Thank you all for the advices!
>My file is generated at runtime, so maybe the TextWrangler filter should
>be a good solution but I don't know how to use it in my script...

Hi Guido.

The various scripts posted so far have been answering different
interpretations of your original query, namely:

1) You want to add a fruit and a number to a document in TextWrangler
which may already contain a list of fruits and numbers.
Or:
2) You have a TextWrangler document containing only a list of fruits and
you want to append numbers to these fruits in the document.
Or:
3) You have a text _file_ containing only a list of fruits and you want
to append numbers to these fruits in the file.

Could you please clarify which you want?

NG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Count word's occurences (From: Nigel Garvey <email@hidden>)

  • Prev by Date: Re: Count word's occurences
  • Next by Date: Re: Count word's occurences
  • Previous by thread: Re: Count word's occurences
  • Next by thread: Re: Count word's occurences
  • Index(es):
    • Date
    • Thread