C-Command Software Forum

Viewing Notes

Is it possible to have an option to invoke Quick Look to view the Note file attached to a Record?

If this was possible it could enhance the use of Notes. For example, an attached Note could store an Abstract of the attached file along with any comments, annotations, links etc. This could make Reference Management/Research with EF much easier.

This works, but no error checking etc

tell application “EagleFiler”
set _records to selected records of browser window 1
repeat with _record in _records
set _noteFile to _record’s note file
set _notePath to _noteFile’s POSIX path
set _script to "qlmanage -p " & _notePath’s quoted form
do shell script _script
end repeat
end tell

That script looks fine. I guess I don’t really understand what you are trying to do. Why Quick Look rather than EagleFiler’s Info window or opening the note in TextEdit?

Hi Michael,

I am trying to find an easy way to view the content of Notes. The Info window is somewhat restricted for large notes. I know of no other way to open Notes from within EagleFiler and trawling through Finder to find the relevant Note is inefficient.

I would like to recreate/create the same Quick Look functionality that already exists within EagleFiler for the PDF’s in my Records (Menu | Record | Quick Look “some record title” - Cmd Y) but for the attached Notes file. I can also open the Notes file from within Quick Look if needed and access the Share menu.

This seems to me to be a quick and efficient way to review Notes files without having to trawl through Finder and also benefitting from the much bigger QL window.

Screenshots/ mock-up to illustrate the point

I think the script that you posted will work. I would modify it slightly to:

tell application "EagleFiler"
    set _records to selected records of browser window 1
    repeat with _record in _records
        set _noteFile to _record's note file
        set _notePath to _noteFile's POSIX path
        set _script to "qlmanage -p " & _notePath's quoted form & " &"
        do shell script _script
    end repeat
end tell

qlmanage does not exit until you close the window, so this modified script (with the & added) will run it in a separate shell so that it doesn’t hang your AppleScript.

Alternatively, you could use something like this:

tell application "EagleFiler"
    set _records to selected records of browser window 1
    repeat with _record in _records
        set _noteFile to _record's note file
        set _notePath to _noteFile's POSIX path
        set _script to "open " & _notePath's quoted form
        do shell script _script
    end repeat
end tell

to open a TextEdit window instead of a Quick Look window.

Many thanks, Michael. This script selects the Record’s note in Finder and views it with Quick Look. It seems to work.

tell application "EagleFiler"
	-- Find Record's attached Note in Finder and display in Quick Look
	-- Ends after first selected Record is processed
	
	try
		set _records to selected records of browser window 1
		repeat with _record in _records
			try
				-- Get path to Record's note
				set _noteFile to _record's note file
				set _Findertarget to _noteFile as text
				
				-- Show Finder window with note file selected
				tell application "Finder"
					reveal _Findertarget
					activate
					
					-- Display Quick Look Window using Spacebar or CMD+Y
					tell application "System Events"
						key code 53 -- Esc to close any open QL window
						-- key code 49 -- Spacebar
						key code 16 using {command down} -- CMD+Y
					end tell
				end tell
				
				
			on error
				-- Exit if selected record has no Note
				-- Or Note does not exist
				display notification "Record's Note not found" with title "EagleFiler"
			end try
			
			-- Exit Script after first selected record processed
			return
			
			-- Tip
			-- Leave any Quick Look window open in Finder
			-- Select Notes behind QL window using Up & Down arrow keys
		end repeat
		
	on error
		return
	end try
end tell

Is there an advantage to this over using qlmanage? A potential issue with using Quick Look in Finder is that the window will go away if you do anything else in Finder.

Fair point, but the selection in the Finder window remains unless deselected. So working in another Finder window/Tab is OK. Easy enough to return to the Notes folder and press CMD+Y or Spacebar to re-display the QL window for the selected file.

The advantage for me is the additional functions (open editor and Share menu) and that I can make the QL window full screen size. QL also plays nicely with the window management tool of choice, Moom. I like QL and use it all the time especially in EF.

I have now worked out how to select all the notes in Finder for all the Records selected.in EF. QL has built-in management for multiple item selections. I will post the code shortly.

So, here is the code to manage the display of Notes in QL for multi Record selections in EF.

-- Find Notes attached to selected Records 
-- Reveal in Finder and display all Notes in Quick Look
-- Quick Look window has file selector buttons to navigate through all selected Notes 
-- Works if all Notes are in the same Folder
-- Version 1.00
-- 24 Apr 22

tell application "EagleFiler"
	
	set _records to selected records of browser window 1
	set _notesCount to 0
	set _finderSelection to {}
	
	if (count of _records) < 1 then
		display notification "No Records Selected" with title "EagleFiler"
		return
	end if
	
	-- Get a list of notes for selected Records
	try
		repeat with _record in _records
			if _record's has note is true then
				set _noteFile to _record's note file
				set _finderFile to _noteFile as text
				set _notesCount to _notesCount + 1
				copy _finderFile to the end of _finderSelection
			end if
		end repeat
	end try
	
	if _notesCount = 0 then
		display notification "No Notes found in selected Records" with title "EagleFiler"
		return
	else
		display notification "Found " & (_notesCount as text) & "  Notes in selected Records" with title "EagleFiler"
	end if
	
	tell application "Finder" -- Show Finder window with note(s) selected
		try
			activate
			reveal (every item of _finderSelection) -- All notes in same folder
		end try
		
		-- Display Quick Look Window
		tell application "System Events" to tell window 1 of application process "Finder"
			key code 53 -- Esc to close any open QL window
			-- key code 49 					-- Spacebar
			key code 16 using {command down} -- CMD+Y
		end tell
	end tell
	return
end tell



Great, thanks for sharing!