Hi All,
The context:
I wrote a script that creates a series of urls in a folder in finder , that are hyperlinks to my projects, with project names as link names. This way, running High Sierra I can use Spotlight to open directly within OF2 the project I am searching for.
My goal is: I want to archive specific projects, and get the URLs to them inside the archive, how can I accomplish that via applescript?
I cannot archive without having the link to the archived document in finder, otherwise I cannot search consistently in one single place (spotlight) which is my main goal.
My problem is: my archiving script is as follows and it does not work:
property proj_name : “test0001”
property archive_file_path : “/Users/XXXXXX/Library/Containers/com.omnigroup.OmniFocus2/Data/Library/Application Support/OmniFocus/Archive.ofocus-archive”
tell application “OmniFocus”
tell default document
set test_archive to (every flattened project whose name is proj_name)
archive test_archive in POSIX file (archive_file_path)
end tell
return test_archive
end tell
Please find below the script to create URLs (I plan to create a separate archive folder but only after I am able to archive and retrieve the URL in the archive).
#—INPUTS FOR Create Project List in Local Folder—start
property FolderPath_for_OF_projects : “/Users/silvano.ricci1@it.ibm.com/Box Sync/workflows and VM/project_list.workflow”
#—INPUTS FOR Create Project List in Local Folder—end##—Create Project List in Local Folder—START
set wfpath to quoted form of POSIX path of FolderPath_for_OF_projects
set command to "/usr/bin/automator " & wfpath
set output to do shell script command
##—Create Project List in Local Folder—END
the mentioned workflow content is:
ACTION 1 Find Finder Items in my OF URLs Folder
ACTION 2 Move Finder Items to trash
ACTION 3 (without input) run the following script
on run {input, parameters}
set mylocation to POSIX file “/Users/XXXXXXX/Desktop/OF Projects/”
tell application “OmniFocus”
set theperspective to “Projects”
tell default document
set Projects_names to name of every flattened project of folder (“All”)
set Projects_ids to id of every flattened project of folder (“All”)
set Projects_status to status of every flattened project of folder (“All”)set OF_xcallback to "omnifocus:///task/" set Projects_list to {} end tell
end tell
repeat with item_counter from 1 to count of Projects_ids
set item_text to item item_counter of Projects_names & " - " & item item_counter of Projects_status & " - " & item item_counter of Projects_ids copy item_text to the end of Projects_list ##set each_item to each_item & " - " & Projects_ids(each_item) ##do shell script "cat /\/* / tell application "Finder" make new internet location file at mylocation to (OF_xcallback & (item item_counter of Projects_ids)) with properties {name:(item item_counter of Projects_names)} end tell
end repeat
return mylocation
end run