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

Vienna 3.8 beta – Applescript: cannot get HTML source #1523

Closed
phiw13 opened this issue Oct 27, 2021 · 14 comments
Closed

Vienna 3.8 beta – Applescript: cannot get HTML source #1523

phiw13 opened this issue Oct 27, 2021 · 14 comments
Labels
stale ⏳ The issue will be closed 60 days after the label was added and no inactivity has occurred since.

Comments

@phiw13
Copy link

phiw13 commented Oct 27, 2021

A basic applescript using get documentHTMLSource to open the HTML source of an article in a code editor fails (per the Vienna AS dictionary).

Result: the script opens a blank document. This fails independently of the “new“ browser (WKWebView). It worked fine in 3.7.x.

The following script opens the HTML source in a new BBEdit document (I have a similar one for SubEthaEdit).

tell application "Vienna"
	set this_source to get documentHTMLSource
	tell application "BBEdit"
		activate
		make new text window with properties {text:this_source, source language:"HTML"}
		select insertion point before text of front text document
	end tell
end tell

PS – this is a bit annoying for debugging feeds as the Web inspector cannot be used in WKWebView, unless I miss a magic incantation. The Web inspector still works in the “old” browser.

@Eitot
Copy link
Contributor

Eitot commented Oct 28, 2021

It only returns the source if the currently active tab is not the articles list/article page.

Perhaps @TAKeanice can explain whether this was intentional.

@TAKeanice
Copy link
Contributor

For the articles tab the HTML is stored in the cache directory and could theoretically be retrieved from there.

I am not sure if the issue is due to a mistake in the Article View or due to the WebView behaving differently when a local document is loaded. It is not intentional.

For the Web Inspector, you can use Safari, provided the private WebKit debugging setting is activated on compiling Vienna. Theoretically that could be made into a setting in Viennas Preferences.

@TAKeanice
Copy link
Contributor

For the debug setting, see Vienna/Sources/Main window/WKPreferences+Private.h

You may turn it on in the initializer of CustomWKWebView.

@phiw13
Copy link
Author

phiw13 commented Oct 30, 2021

I am not sure if the issue is due to a mistake in the Article View or due to the WebView behaving differently when a local document is loaded. It is not intentional.

hmm. Hopefully there is some sort of workaround?

For the Web Inspector,[…]Theoretically that could be made into a setting in Viennas Preferences.

Now that would be quite nice, I suspect I am not the only one who uses the inspector tool.

@Eitot
Copy link
Contributor

Eitot commented Oct 30, 2021

The web inspector within Vienna has never worked for me; it just overlays an opaque view onto the webview. I am not keen on exposing this to release builds.

Screenshot 2021-10-30 at 13 17 12

Screenshot 2021-10-30 at 13 17 26

@phiw13
Copy link
Author

phiw13 commented Oct 30, 2021

Didn’t this command work for you ? (quit Vienna beforehand…)

defaults write uk.co.opencommunity.vienna2 WebKitDeveloperExtras -bool true

That has worked for a long time, and still does as long as you have the “old” browser enabled. Right click any element in article view, you’ll see the “Inspect element” entry in the context menu.

Vienna Inspector

@Eitot
Copy link
Contributor

Eitot commented Oct 30, 2021

I have only tested it in developer builds with the WebKit (“new”) browser enabled. The WebKitDeveloperExtras default makes no difference.

@phiw13
Copy link
Author

phiw13 commented Oct 30, 2021

Yes with WKWebView that command does not work (as alluded in my OP), lots of discussions on stackoverflow about that. That is why I turned back to my Old Applescript(s) only that does not work either (In Vienna; I have a AppleScript working with NNW).

@Eitot
Copy link
Contributor

Eitot commented Oct 30, 2021

I was merely pointing out that exposing the web inspector private API via a toggle in advanced preferences, as suggested by TAKeanice, is not an option. Instead, the AppleScript function documentHTMLSource has to be fixed, so that it also returns the page source of the article, as it does in Vienna 3.7 and older.

@barijaona
Copy link
Member

For me, access to debugging is possible through Safari's Development menu.
Once this menu is activated (cf. Safari's advanced preferences), a submenu with your machine's name appears into it : Vienna's tab are listed there and can be selected.

You probably also need the defaults write uk.co.opencommunity.vienna2 WebKitDeveloperExtras -bool true command beforehand.

@github-actions
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 Apr 29, 2023
@phiw13
Copy link
Author

phiw13 commented May 8, 2023

this is still relevant, FWIW

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

This will be fixed in 3.9.0, at least for recent versions macOS Ventura (commit e0f288b2ed57ec5e486300a2b3555bc57fe2c000 included in PR #1666)

Copy link

github-actions bot commented May 9, 2024

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 May 9, 2024
@github-actions github-actions bot closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale ⏳ The issue will be closed 60 days after the label was added and no inactivity has occurred since.
Projects
None yet
Development

No branches or pull requests

4 participants