Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applescript #1645

Open
Atalantia opened this issue Nov 23, 2022 · 11 comments
Open

Applescript #1645

Atalantia opened this issue Nov 23, 2022 · 11 comments

Comments

@Atalantia
Copy link

Describe the bug
Applescript seems not to work
To Reproduce

tell application "Vienna"
repeat with x in articles of folders
if date of x is less than (my (current date)) - 3 * days then delete x
end repeat
end tell

also not working:

tell application "Vienna"
mark all read in folder "Papierkorb"
end tell

Please complete the following information:

  • Vienna version 3.8.4
  • OS version: macOS 10.14
@barijaona
Copy link
Member

I don't have 10.14 to test (I am on macOS 13), and I did not want to delete articles from my database, but these tests worked as expected for me :

tell application "Vienna"
	repeat with x in articles of folders
		if date of x is less than (my (current date)) - 365 * days then display dialog ((title of x) as string)
	end repeat
end tell

and

tell application "Vienna"
	mark all read in folder "Cocoaforge"
end tell

@Atalantia
Copy link
Author

Atalantia commented Nov 24, 2022

tell application "Vienna" to mark all read in folder "Old"
Does NOT work on 10.14.6 on a smart folder.

@barijaona
Copy link
Member

tell application "Vienna" to mark all read in folder "Old"
Does NOT work on 10.14.6 on a smart folder.

Works here (macOS 13)
I will setup a 10.13 virtual machine (probably this week-end) and I will investigate

Does opening of Vienna's dictionary in Script Editor works as expected ?

@barijaona
Copy link
Member

Also: can you check if you have the same issue with Vienna 3.7.5 ?

@Atalantia
Copy link
Author

Atalantia commented Nov 24, 2022

I have 3.8.4.

  1. Look, the command:
    tell application "Vienna" to mark all read in folder "Old"
    sets the articles in the selected folder in Vienna to "mark as read" Means the frontmost folders content gets, marked as read. But not the folder mentioned in the script "Old"

  2. The "delete" command I cant make it work on any articles.

@barijaona
Copy link
Member

barijaona commented Nov 26, 2022

Problem confirmed. I will have a look.

  1. Look, the command:
    tell application "Vienna" to mark all read in folder "Old"
    sets the articles in the selected folder in Vienna to "mark as read" Means the frontmost folders content gets, marked as read. But not the folder mentioned in the script "Old"
  2. The "delete" command I cant make it work on any articles.

@Eitot
Copy link
Contributor

Eitot commented Nov 29, 2022

Is this a regression in #1481?

@barijaona
Copy link
Member

Is this a regression in #1481?

Quite possible for the first problem, which does not appear on 3.8.0_Beta1

For the second problem, I guess they were discrepancies in ViennaApp.scriptSuite / ViennaApp.scriptTerminology which were transposed in Vienna.sdef

@Eitot
Copy link
Contributor

Eitot commented Dec 9, 2022

@barijaona: Problem 1 works differently for me. When I want to mark folder X as read but have folder Y selected, it marks both folders as read. This isn't a bug in AppleScript, but in Vienna itself, specifically this part here:

Folder * currentFolder = [[Database sharedManager] folderFromID:currentFolderId];
if (currentFolder != nil && ![folderArray containsObject:currentFolder])
{
for (Article * theArticle in folderArrayOfArticles)
[theArticle markRead:YES];
}

It marks every article in folderArrayOfArticles as read, which includes more than just the articles of folder X.

As for problem 2, the Vienna scripting definition has no methods for the Article and Folder objects, only properties. The ViennaApp object does have methods and some of them take Article or Folder objects as arguments. This is indeed something that Vienna didn't have before. In this specific case, the delete command is actually not defined by Vienna, but by the "standard suite" provided by Cocoa. It doesn't seem to recognise Article or Folder objects as valid arguments for the delete command.

Copy link

This issue hasn't been updated in a while so we're going to mark it as stale. stale issues will automatically be closed after 60 days of inactivity. If this issue is still affecting you, please update us on how it affects you, and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. Thank you for your contributions.

@github-actions github-actions bot added the stale ⏳ The issue will be closed 60 days after the label was added and no inactivity has occurred since. label Dec 12, 2023
@barijaona
Copy link
Member

barijaona commented Jan 21, 2024

Vienna's support for AppleScript is not very satisfactory:

  • some features are listed in the .sdef but are not operational; this is frustrating for users; we should at least tidy things up;
  • on the other hand, we need to identify the functions that would be most useful to scripters.

The current implementation clearly needs some refactoring, but I think it's worth the effort. It might also help with Shortcuts support.

Related: issue #1523

@barijaona barijaona added developer request 🙏 and removed stale ⏳ The issue will be closed 60 days after the label was added and no inactivity has occurred since. labels Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants