C-Command Software Forum

Script to set URL to Note Text

I am a novice at AppleScript. I am trying to write a script to set the URL of a record to the Note text. Here is what I came up with:

tell application "EagleFiler"
	set theRecords to selected records of browser window 1
	repeat with theRecord in theRecords
		set theURL to theRecord's note text
		set theRecord's source URL to theURL
		set theNewNote to ""
		set theRecord's note text to theNewNote
	end repeat
end tell

Happily, this works to set the URL to the note text, but then I want to delete the note text. This part is not working. Is there someone with more experience in AppleScript that can help me out with this?

It seems to be working on my Mac, although it looks like there’s a bug where the text view in the Info inspector doesn’t immediately update its display. If I click on another record and then click back, the note text is gone. (And the note tag is removed right away.)

Oh, I didn’t notice that the note tag was gone. I can now see that this works for me too, clicking away from the record and then clicking back. I didn’t think of doing that. Thanks for the quick reply!

In case anyone is interested, I modified this script to ignore records with no note so existing URLs do not get wiped out inadvertently.

tell application "EagleFiler"
	set theRecords to selected records of browser window 1
	repeat with theRecord in theRecords
		if has note of theRecord is true then
			set theURL to theRecord's note text
			set theRecord's source URL to theURL
			set theNewNote to ""
			set theRecord's note text to theNewNote
		end if
	end repeat
end tell