I do not consider myself proficient at scripting. This script is basic and works when I test it.
- Creates project with name equal to file's parent folder name
- Creates task inside project with context set as "Mac"
- Creates note for task with comment and link to file
I hope this helps getting you closer to what you want to do with your initial question.
Code:
tell application "Finder"
set project_name to name of container of (theFile)
set file_name to name of (theFile)
set the_date to current date
set the_note to "Added on " & (the_date as string) & "
"
end tell
tell application "OmniFocus"
tell default document
set the_project to make new project with properties {name:project_name}
set the_context to first flattened context where its name = "Mac"
tell the_project
set the_action to make new task with properties {name:"Review \"" & file_name & "\"", context:the_context}
set note of the_action to the_note
tell the note of the_action
make new file attachment with properties {file name:theFile, embedded:false}
end tell
end tell
end tell
end tell