Opening a record with 'get url' and the id property of records

Hello,

I have written a short AppleScript to import a link to a web site as plain text. I mostly just copied code from one of the import scripts https://c-command.com/scripts/eaglefiler/, and I wonder if it is possible to after importing open a record via the records id and x-eaglefiler URLs or with some similar approach.

I have made two versions of the script as Automator Quick Actions. One which imports the link adds notes and hides EagleFiler, and in the other version I would like the ability to open the newly added record for adding some notes or description about the link. I prefer not to have System Events.app activated in Accessibility on my system so GUI scripting is not an alternative.

I thought maybe it is possible to open a record with ‘get url’ and an x-eaglefiler URL and the record’s id supplied.

The above idea is for convenience and not very important, but if it is possible it would be convenient.

Regards,
Martin

on run {input, parameters}
	tell application "EagleFiler"
		activate
		set _content to (the clipboard as text)
		set _rv_title to display dialog "Titel till länken i EagleFiler:" default answer "" with icon note buttons {"Cancel", "OK"} default button "OK" with title _content
		set _title to text returned of _rv_title
		set ef_library_path to POSIX file "/path/to/eaglefiler/EagleFiler.eflibrary"
		set _ef_library to ef_library_path as alias
		if button returned of _rv_title = "OK" then
			try
				open _ef_library
				tell library document 1
					set {_record} to import plain text _content note _content -- add _content to note as source URL cannot be copied from Get Info window 
					set _record's title to "URL: " & _title
					set _record's source URL to _content
				end tell
			on error
				display alert "Kunde inte öppna EagleFilers library: " & ef_library_path
			end try
		else
			-- user canceled operation
		end if
	end tell
	return input
end run

Feeling appropriately foolish I am following up to myself. You can get the records file and tell Finder or another application to open the file. ‘get url’ and x-eaglefiler urls are not needed to open the imported file.

set _record_file to _record's file
tell application "BBEdit"
    open _record_file
end tell

Regards,
Martin

You may prefer to use the with asking for options option for the import script command. Then EagleFiler will prompt you to add notes and other metadata.

Yes, you can do that like so:

tell application "EagleFiler"
    set {_record} to import plain text "Test" with asking for options
    set _url to _record's URL
    get url _url
end tell

You can copy the source URL from the Info window by Control-clicking or by using the command in the Edit menu.

Thank you. I much prefer to be able to add notes about the link without opening another application. It also makes one command less in the Services menu. I do not know why I missed the options to the import command in the EagleFiler Dictionary. importing URLs also looks like a better alternative. With notes stored in the Get Info window perhaps in bookmark format.

Regards,
Martin