Getting grok, DT4 and DTTG to work better together

Goal: To preserve a readable across many digital environments (OS’s, apps, etc.) immutable digital copy of grok prompts and responses.

Current focus: Using DT4 and DTTG as key tools. (as I have been for many, many years dating back to the last century.:grinning_face:

Present situation: Unable to end up with a properly formatted PDF via the many DT input mechanisms. (command P > Command P; Clip to DT’s various methods from plain text down through and including PDF paginated. (see attached)

Thoughts?

I’ve been using Grok recently, and what I do is press the relevant Grok icon (bottom left of last answer … looks like two stacked files) that creates a Markdown text in the clipboard, then I use DEVONthink’s Sorter, paste in, then save into the relevant DEVONthink location. Grok also provides a way to make a text to clipboard, but I don’t use it. If I want a PDF of that Markdown Grok document, I use DEVONthink’s “Convert to PDF”.

Probably a way I can automate going directly to PDF, but I don’t always want that and I don’t do it enough to try to automate. But likely possible with a Smart Rule or something.

1 Like

I don’t use Grok, so I didn’t know about the option @rmschne mentioned. That seems like the best way to me.

Other options you could try (all on macOS):

  • In Safari, use File > Export as PDF…
    • The X website has no print styling, so printing to a paginated PDF doesn’t work very well. This option instead creates one big PDF from the contents of the browser window, with searchable text and working links. Also useful for other sites.
  • Open the site directly in DT’s internal browser, input your prompts and capture from there.
  • Select a part of the page, then capture using DT’s system services.

@rmschne and @troejgaard Thank you both. Your suggestions have solved my situation.

@troejgaard I’ve avoided the File > Export as PDF…, because unless I’m missing something I can’t export directly into a DT database? Which means, I’m stuck with lots of extra steps to get an pdf into DT.

Either of you guys have any idea of what works for similar PDF outcome for x.com posts?

You have been able to target a specific location for years and years if the Files > Import > Destination setting is set to Select Group.

@BLUEFROG Indeed I do. And I have been using just such greatness via the command + P > Command + P steps to convert a webpage in safari from all sorts of different webpages. But not by way of The File > Export As PDF while in safari. For obvious reasons.

The focus remains, how best, judging by the least amount of keystrokes, time consumed and more…, how to get an immutable copy of a x.com posting into DT and DTTG?

If you set up the global inbox alias for Finder, you can choose that as the destination in save dialogs. (DEVONthink > Install Add-Ons… > Global Inbox in Save Dialogs).

You can also assign a keyboard shortcut to Safari’s File > Export as PDF… I use ⇧⌘P. The save dialog remembers the last used location, so if that was the global inbox alias, the sequence is ⇧⌘P, ⏎ . I think that’s pretty quick?

1 Like

@troejgaard Indeed! Let me give it a try. Thank you and @BLUEFROG for you patience and assistance. I’ll revert after testing.

1 Like

@troejgaard Thank you again. your suggestion, including the shortcut works pretty well. The end product is formatted in readable PDF that land in DT’s inbox. Thank you. I say pretty well, because…

@BLUEFROG Anything that can be done to include the URL in the final PDF’s Inspector > Generic > URL field, like with other methods, is much appreciated.

@troejgaard My work around to ensure the original URL stays with the pdf is to circle back to the webpage > copy URL > paste URL into above listed field.

Thank you both

Yeah, that’s also bugged me a little. Your question prompted me to come up with a solution: A smart rule that grabs the URL of the current Safari tab with a script. In that case it’s probably better to use a single-purpose indexed folder as the save location (rather than the Global Inbox alias) to limit the scope and avoid unintended triggers.

The Display Notification action is feedback that I can change tabs and lets me confirm that the correct URL was added . You can use another form of feedback if you like. (Bounce Dock Icon, Play Sound etc.)

Here is the script:

function performsmartrule(records) {
	const DT = Application("DEVONthink"),
		  Safari = Application("Safari");
	for (app of [DT, Safari]) app.includeStandardAdditions = true;
	
	if (!Safari.running()) throw "Safari is not running.";
	const tab = Safari.windows[0].currentTab;
	const link = tab.exists() ? tab.url() : null;
	if (!link) throw "No Safari window open.";
	
	const r = records[0];
	r.url = link;
	DT.logMessage(
	 `Grabbed URL from Safari:\n${link}`, {record:r}
	);
	
	if (records.length > 1)
	  DT.logMessage(
	   `${records.length} records matched; not intended. ` +
	   `URL added to first match only.`
	  );
}

PS: const tab = ...; const link = ...; could also be written shorter as
const link = Safari.windows()[0]?.currentTab.url();
I’m not sure which to prefer.

1 Like

@troejgaard Thank you for the extra effort. You are so kind. I’m not a programmer, so you have given me an opportunity to grow my skills. I’ll revert with update(s). Thank you again!

1 Like