Ranchero-Software / NetNewsWire

RSS reader for macOS and iOS.
https://netnewswire.com/
MIT License
8.33k stars 528 forks source link

AppleScript: "allWebFeeds of account "Feedly" doesn’t understand the “count” message. #2486

Open ghost opened 4 years ago

ghost commented 4 years ago

Trying to use AppleScript to iterate through my NetNewsWire feeds, and I get the following error:

NetNewsWire got an error: every item of allWebFeeds of account "Feedly" doesn’t understand the “count” message.

tell application "NetNewsWire"
    set myArticle to {}
    copy "---\nlayout: post\ntitle: What I'm Reading: " & (do shell script "date +'%A, %B %e, %Y'") & "\ndate: " & (do shell script "date +'%FT%T'") & "\ncategories:\n  - What I'm Reading\n---\n\n" to the end of myArticle
    repeat with thisFeed in items of allWebFeeds of account "Feedly"
        repeat with thisArticle in thisFeed
            if thisArticle is starred then
                copy "* **" & name of webFeed & ":** [" & title of thisArticle & "](" & url of thisArticle & ")\n\n" to the end of myArticle
            end if
        end repeat
    end repeat
    return myArticle as string
end tell
georgesnow commented 4 years ago

I think you need to go level deeper for the count. This will return the number of Feeds you have inside the Folders which are within the Feedly account. Then the article is contained within the webFeed itself.

here is the count of webFeeds (where the folder is named Tech):

`tell application "NetNewsWire" return count (every webFeed of folder "Tech" of account "Feedly" as item)

end tell`

count the articles within the first webFeed:

`tell application "NetNewsWire" return count (every article of first webFeed of folder "Tech" of account "Feedly" as item)

end tell`

georgesnow commented 4 years ago

I think is what you want. I recommended making more specific the 2 loops takes considerable amount of time: (sorry multiples edits didn't know how to do the syntax highlighting)

tell application "NetNewsWire"
    set myArticle to {}
    copy "---
layout: post
title: What I'm Reading: " & (do shell script "date +'%A, %B %e, %Y'") & "
date: " & (do shell script "date +'%FT%T'") & "
categories:
  - What I'm Reading
---

" to the end of myArticle
    repeat with thisFeed in webFeed of folder "Tech" of account "Feedly" as item
        repeat with thisArticle in article of thisFeed as item

            if thisArticle is starred then
                --return title of thisArticle
                copy "* **" & name of webFeed of thisArticle & ":** [" & title of thisArticle & "](" & url of thisArticle & ")

" to the end of myArticle
            end if
        end repeat
    end repeat
    return myArticle as string
end tell
hydroclaus commented 2 years ago

I get a similar error when I try to get my starred articles:

NetNewsWire got an error: every folder of account id "iCloud" doesn’t understand the “count” message.

I have 10 folders setup on iCloud over which I try to loop. The error occurs in the line repeat with nthFolder in folders of userFeeds (also, I am novice in applescript - so this could be easily a problem on my end, but I'd appreciate any thoughts)

tell application "NetNewsWire"
    set allAccounts to every account
    set userFeeds to item 2 of allAccounts -- item 2 is the iCloud account
    repeat with nthFolder in folders of userFeeds
        repeat with nthFeed in nthFolder
            set starredArticles to (get every article of nthFeed where starred is true)
            repeat with nthArticle in starredArticles
                my openinDt(url of nthArticle, name of nthArticle)
            end repeat
        end repeat
    end repeat
end tell
georgesnow commented 2 years ago

this might help you get closer to the correct direction.

tell application "NetNewsWire"
    set allAccounts to every account
    set userFeeds to item 2 of allAccounts -- item 2 is the iCloud account
    --return properties of every webFeed --whose starred is true
    repeat with nthFolder in folders of userFeeds as item
        --I think this is what you are trying to get back
        set starredArticles to (every article of every webFeed of nthFolder whose starred is true)
        return starredArticles
                --^ you can comment this line and see the return

        --comment down each of these to try tweak your loop
                return firstItem to first item of starredArticles
        return firstArt to item 1 of firstItem
        return theTitle to title of firstArt
        return theURL to url of firstArt

    end repeat
end tell
brentsimmons commented 1 year ago

Is there a bug or feature request here?