I have cobbled together something to help me organize what I want to buy when I hear something I like. I get the following error and am not sure what I’m doing wrong. The display dialog works, but I wanted to add a screen shot of the album so when I hunt it down I buy the right one.
ERROR:Finder got an error: Can’t make “Macintosh HD:Users:MG:Downloads:” into type alias.
Here’s the code:
--Building a script to make new notes for Music I want while listening to Qobuz, Sirius XM, RadioParadise, Tidal etc...
set noteTitle to ""
--Provide the CD info like Title, Band, Song
display dialog "Enter the CD title, Band & Album Name:" default answer "" buttons {"Cancel", "OK"} default button "OK"
set noteTitle to text returned of result
--Provide other info as needed
set noteBody to ""
display dialog "Put in some text:" default answer "" buttons {"Cancel", "OK"} default button "OK"
set noteBody to text returned of result
--Looking for the screenshot from the music streaming service. Currently download folder
set downloadsFolder to (path to downloads folder) as text -- Get the path to the Downloads folder
--error message: Finder got an error: Can’t make "Macintosh HD:Users:MG:Downloads:" into type alias.
tell application "Finder"
set screenshotPath to choose file of type {"public.image"} with prompt "Select a screenshot file:" default location downloadsFolder -- Prompt to choose a screenshot file
end tell
tell application "Notes"
activate
--Make new note with the dialogue results and the screenshot attachement.
--attach file screenshotPath to newNote -- Attach the selected screenshot file to the new note
tell default account to tell folder "Music"
tell folder "CD's to buy"
set newNote to make new note with properties {name:noteTitle, body:noteBody, screenshotPath:attachment}
end tell
end tell
end tell
Ok, fixed that but I have a new error.
Notes got an error: Can’t make {name:“The Who Who’s Next Going Mobile”, body:“Have it”, downloadsFolder:attachment} into type properties of note.
I’m guessing it’s in the setnewNote section with properties.
I’m not sure how to fix the properties. What I’d like is for a copy of the physicalscreenshot to be pasted into the body of the new note. I can get the path, but not the actual picture: Need to nudge in right direction.
--Building a script to make new notes for Music I want while listening to Qobuz, Sirius XM, RadioParadise, Tidal etc...
set noteTitle to ""
--Provide the CD info like Title, Band, Song
display dialog "Enter the CD title, Band & Album Name:" default answer "" buttons {"Cancel", "OK"} default button "OK"
set noteTitle to text returned of result
--Provide other info as needed
--set noteBody to ""
--display dialog "Put in some text:" default answer "" buttons {"Cancel", "OK"} default button "OK"
--set noteBody to text returned of result
--Looking for the screenshot from the music streaming service. Currently download folder
set downloadsFolder to (path to downloads folder) -- Get the path to the Downloads folder
--error message: Finder got an error: Can’t make "Macintosh HD:Users:MG:Downloads:" into type alias.
tell application "Finder"
set screenshotPath to choose file of type {"public.image"} with prompt "Select a screenshot file:" default location downloadsFolder -- Prompt to choose a screenshot file
end tell
tell application "Notes"
activate
--Make new note with the dialogue results and the screenshot attachement.
--attach file screenshotPath to newNote -- Attach the selected screenshot file to the new note
tell default account to tell folder "Music"
tell folder "CD's to buy"
set newNote to make new note with properties {name:noteTitle, body:screenshotPath}
end tell
end tell
end tell
Just to clarify: I’m sure there are many implementations possible but my original script attached to the start of this thread is already fully functional, FYI.
I appreciate your feedback. I’m going to take a look and your suggestions and see what I can do. I got the solution you referenced working and it does what I need. Thank you for your help. It’s a neat little script.
--Building a script to make new notes for Music I want while listening to Qobuz, Sirius XM, RadioParadise, Tidal etc...
set noteTitle to ""
--Provide the CD info like Title, Band, Song
display dialog "Enter the CD title, Band & Album Name:" default answer "" buttons {"Cancel", "OK"} default button "OK"
set noteTitle to text returned of result
--Provide other info as needed
set noteBody to ""
display dialog "Put in some text:" default answer "" buttons {"Cancel", "OK"} default button "OK"
set noteBody to text returned of result
--Looking for the screenshot from the music streaming service. Currently download folder
set downloadsFolder to (path to downloads folder) -- Get the path to the Downloads folder
tell application "Finder"
set screenshotPath to choose file of type {"public.image"} with prompt "Select a screenshot file:" default location downloadsFolder -- Prompt to choose a screenshot file
end tell
tell application "Notes"
activate
tell default account
tell folder "Music"
tell folder "CD's to buy"
set theNote to make new note with properties {name:noteTitle}
tell theNote
delete attachments
set body to noteBody
make new attachment at end of attachments with data screenshotPath
delete attachment 1
set name to noteTitle
end tell
end tell
end tell
end tell
end tell