The Add Files command adds a list of files to a database as digital resources. As files are added they are issued unique integer IDs. By default, certain types of files may be parsed and referenced files added/updated in the database. Optionally, information about files already in the database may also be updated.
[update existing files update_option]
Example: Adding folders and files.
-- Adds two folders of files to the Virtual Ticket database.
tell application "Virtual Ticket 8.0" to
set ids1 to Add Files {"Jobs:000001 - Rockport Spring Cat:",¬
"Jobs:000002 - Builders Catalogue:Annual Report"}
-- Adds a single quark file with no references to other files
-- to the Virtual Ticket database.
set ids2 to Add Files¬
(alias "Jobs:000003 - Wellness and Fitness:Brochure")¬
with update existing files without links
end tell
Example: Adding and deleting a digital resource from a file collector field in a form.
-- Adds a digital resource to the Customer_Files file collector
tell application "Virtual Ticket 8.0"
set digitalResourcesIds to Add Files¬
{"Jobs:000001 - Rockport Spring Cat:Brochure"}¬
with links and update existing files
set job to Retrieve Object Record of type "Jobs" with id 1
set |Customer_Files| of job to |Customer_Files| of¬
Update Object Record of type "Jobs" with id 1 with fields job
-- Deletes a digital resource from the Customer_Files file collector
-- field of job number 1. Note the digital resource itself
-- is not deleted from the database.
tell application "Virtual Ticket 8.0"
set job to Retrieve Object Record of type "Jobs" with id 1
set digitalResourceIds to |Customer_Files| of job
set digitalResourcePaths to Get Digital Resource Paths¬
set |Customer_Files| of job to {}
repeat with path in digitalResourcePaths
if ("Jobs:000001 - Rockport Spring Cat:Brochure" is not equal¬
set |Customer_Files| of job to |Customer_Files| of job¬
& (item i of digitalResourceIds)
Update Object Record of type "Jobs" with id 1 with fields job